I really like Java 8 streams and Guava\'s immutable collections, but I can\'t figure out how to use the two together.
For example, how do I implement a Java 8 Collec
Although it doesn't answer specifically the question, it's noteworthy to mention that this simple pattern can help everyone building Guava's immutable collections from streams without having the need for Collector
s (as their implementations are rather hard to make).
Stream stream = ...
ImmutableXxx collection = ImmutableXxx.copyOf(stream.iterator());