java 8 iterating and manipulating list code example
Example 1: java 8 iterating and manipulating list
childrenList.stream()
.map(this::convertChildToPerson)
.forEachOrdered(personList::add);
Example 2: java 8 iterating and manipulating list
List<Person> newList = childrenList.stream()
.map(this::convertChildToPerson)
.collect(Collectors.toList());
personList.addAll(newList);