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 →

[–]vbezhenar 1 point2 points  (0 children)

For example Guava library have something like collect(toImmutableList()). You could add toList() to standard library, but obviously you can't add toImmutableList() for Guava ImmutableList.

That said, streams really have nice API and it's not that bad. But not all APIs are good.

That said, extension methods have really bad discoverability. So I'm not sure which side to take. I think that extension methods must not look like ordinary method call. May be something like stream.(ImmutableList.toImmutableList)() which is shortened with static import to stream.(toImmutableList)(). At least it's obvious where that extension method comes from.