Top "Collectors" questions

Collector, as of Java 8, is a mutating reduction operation on a Stream.

Java 8 stream api how to collect List to Object

I have two simple class ImageEntity and ImageList how to collect result list ImageEntity to ImageList ? List<File> …

lambda java-8 java-stream collect collectors
Map to List after filtering on Map's key using Java8 stream

I have a Map<String, List<String>>. I want to transform this map to a List …

java list java-8 hashmap collectors
Java 8 Stream "collect and group by" objects that map to multiple keys

I have the following objects: public class Item { String value; List<Person> owners; Person creator; } public class Person { …

java-8 java-stream collectors
Creating Map composed of 2 Lists using stream().collect in Java

As for example, there are two lists: List<Double> list1 = Arrays.asList(1.0, 2.0); List<String> list2 = Arrays.…

java-8 java-stream collectors
Java 8 streams group by 3 fields and aggregate by sum and count produce single line output

I know there a similar questions asked in the forum but none of them seem to be addressing my problem …

lambda java-8 java-stream chaining collectors
Stream groupingBy: reducing to first element of list

I have a List<Valuta> which can be represented (simplified) JSON-style: [ { codice=EUR, description=Euro, ratio=1 }, { codice=USD, …

java java-8 grouping java-stream collectors
How to use stream in Java 8 to collect a couple of fields into one list?

For example I have class Person with name and surname fields. I want to collect a List of String (names …

java java-8 java-stream collectors
What's the purpose of partitioningBy

For example, if I intend to partition some elements, I could do something like: Stream.of("I", "Love", "Stack Overflow") .…

java java-8 collectors
How to apply Filtering on groupBy in java streams

How do you group first and then apply filtering using Java streams? Example: Consider this Employee class: I want to …

java java-8 java-stream java-9 collectors
Java 8 lambdas grouping by multiple fields

I have a list of pojos that I want to perform some grouping on. Something like: public class Pojo { private …

java java-8 java-stream collectors