I have a List of class A objects with several fields, including number1 and number2 , among others.
I want to extract all unique values โโof number1 and number2 from List<A> via java 8 Stream s.
The map function helps me get only one field, as shown below:
list.stream().map(A::getNumber1);
And after this code is executed, there is no way to extract number2 . How can i do this?
source share