5 comments

[ 5.0 ms ] story [ 19.2 ms ] thread
Usually when using Java streams, I’m mid-thought and the IDE cannot offer suggestions on my not-yet-syntactically-valid code. I end up typing the whole Collectors part by sheer muscle memory. I think this makes sense.
Little know fact, you can specify the type in a stream variable declaration. This helps the IDE (and the next guy) figure out what you're trying to do:

orders.stream().filter((Order filterCandidate) -> filterCandidate.getTotal() > 2000).collect(toList());

Huh... neat. Did not know that.
I've only found a handful of references to it on the internet. Type safety is a huge advantage of Java; surprised it's not the default.

Kinda makes me wonder what else I'm missing though.

It’s type safe once you have it all written out and syntactically valid. Just like you can omit types when working with generics using diamond operator. However, this is a nice reminder that lambda argument types can help sometimes.