I have this situation:
Class Employee{
//some attributes
List<String> idContract
//getter, setter
}
And I need to retrieve a List idContracts from a list using java 8 stream.
I was trying something like that:
lst.stream().filter(o->!o.getLstDipFuoriSoglia().isEmpty())
.map(ResultOdg::getLstDipFuoriSoglia)
.collect(Collectors.toList());
but that, of course, returns a List< List < String >>, so how can I achieve that goal?
Thanks for your answers
flatMap. docs.oracle.com/javase/8/docs/api/java/util/stream/….mapas it is, and add.flatMap(List::stream).getLstDipFuoriSogliain the code? IslstaList<Employee>? How isResultOdgdefined?