The teeing collector, available since Java 12 as Collectors::teeing, forwards its input to two other collectors before merging their results with a function.
My first stab at exception handling in Java streams. Explores how to repackage checked exceptions so that they can be thrown without the compiler complaining about it.
Articles about Java streams often repeat a bunch of tropes: streams are for succinctness, ugly mechanics are the norm, anemic pipelines, magic collectors, and weak exception handling. This is a rebuttal to all of them!
There I go babbling about new stream methods and then I forget one: a Stream::iterate overload that produces a finite stream.
Java 9 is coming! And it is more than just Jigsaw. One of the many changes are new Stream methods: ‘takeWhile’, ‘dropWhile’, and ‘ofNullable’. For more fun with streams!
When using Stream.findFirst() or findAny(), you will often assume that there is at most one element left in the stream. But neither tests that assumption so maybe you should use a different approach.
After my last post you had some ideas about how else to benchmark stream performance. I implemented them and here are the results.
A close look at stream performance. How do they compare to for and for-each loops oder arrays and lists. And what roles play boxing and the complexity of the executed operation?
Proposal to implement new casting methods on Java’s Class. They aim to fulfill the need for improved ways to cast which was created by Java 8’s Optional and Stream.