> From: "Viktor Klang"
> To: "Remi Forax" , "core-libs-dev"
>
> Sent: Thursday, January 2, 2025 12:26:08 PM
> Subject: Re: [External] : Gatherers.fold()
> Hi Rémi,
Happy new year,
>>Thinking a little more, i do not understand why fol
2024 10:39
To: core-libs-dev
Cc: Viktor Klang
Subject: [External] : Gatherers.fold()
Hello Victor,
for the Advent of code of yesterday [1], i've this code golfing solution (the
full code is here [2])
var input = ...;
class Node {
final HashMap map = new HashMap<>();
bo
indexOf('\n')).split(", "))
.forEach(w -> w.chars().boxed().gather(Gatherers.fold(() -> root,
(n, c) -> n.map.computeIfAbsent(c, _ -> new
Node(.findFirst().orElseThrow().end = true);
println(input.lines().skip(2).filter(w ->
w.chars().box