Kotlin printer: streams as collection operations

Đang mở
#233 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, kotlin
Lĩnh vực
tooling

Hướng nghiên cứu

Start in the Kotlin printer code that translates Java stream expression chains, and run the existing printer tests to observe the current output. Implement the stage, terminal, laziness, and unsupported-operation mappings listed in the issue. Done means supported Collection.stream() chains become Kotlin collection operations, while unsupported cases such as findFirst, count, limit, and flatMap remain streams.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Split off from #231. Java translated to Kotlin keeps its streams: names.stream().filter(…).map(…).collect(Collectors.toList()) (.stream() 40 / 77 / 30 times in the langchain4j / fernflower / guava output). Kotlin's collections have these operations themselves.

First pass, a chain from Collection.stream():

  • stages filter, map, distinct, sorted() (Comparable elements), sorted(c) → sortedWith(c); filter(Objects::nonNull) → filterNotNull()
  • terminals collect(toList()) / toList() → nothing, toList() or toMutableList() as the position takes it; collect(toSet()) → toSet() / toMutableSet(); collect(joining(…)) → joinToString(…); anyMatch / allMatch / noneMatch → any / all / none; forEach
  • where Java's laziness can show (a short-circuiting terminal or forEach after a stage): asSequence()

Anything else stays a stream: findFirst (that is the Optional item of #231), count, mapToInt, limit, flatMap, custom collectors, Arrays.stream, Stream.of.

🤖 Generated with Claude Code

Ngôn ngữ chính
Java
Star
1
Fork
1
Merge trung bình
48 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CodeLaser/maddi

Tất cả issue của CodeLaser/maddi

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.