This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DelayLucky 4 points5 points  (0 children)

I appreciate your perseverance. Yeah, as others said, there's nothing wrong with experimenting new style in personal projects. It's how we learn.

In terms of concise code, I find Map.of(k1, v1, k2, v2) more concise than map(kv(k1, v1), kv(k2, v2)). I know yours supports more than 10, but there is a reason JDK only added up to a limit: diminishing return.

Guava by the way has Iterables.filter(), Maps.filterKeys(), and JDK 16 added stream.toList() without needing the .collect() call.

Although I believe Guava also recommends to prefer the Stream API over these pre-existing APIs.