はじめに 明けましておめでとうございます! 年末年始でKotlinで木構造を宣言的に扱うためのkotlin-treeというOSSを公開しました! KotlinのCollection APIのように木構造を処理することができます。楽! val treeNode: TreeNode<Int> = nodeOf( 1, mutableListOf( nodeOf( 11, mutableList( leafOf(111), leafOf(112) ) ), leafOf(12) ) ) // 1 // ├── 11 // │ ├── 111 // │ └── 112 // └── 12 treeNode.map { ele -> ele * 2 } // 2 // ├── 22 // │ ├── 222 // │ └── 224 // └── 24 以下作ったモチベーションをつらつら書きます。