Kotlin printer: streams as collection operations

オープン
#233 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, kotlin
領域
tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Java
スター
1
フォーク
1
平均マージ
48分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CodeLaser/maddi のほかの issue

CodeLaser/maddi の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。