Re: [External] : Gatherers.fold()

2025-01-02 Thread forax
> 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

Re: [External] : Gatherers.fold()

2025-01-02 Thread Viktor Klang
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

Gatherers.fold()

2024-12-20 Thread Remi Forax
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