Is it possible in Java 8 to write something like this:
List<A> aList = getAList();
List<B> bList = new ArrayList<>();
for(A a : aList) {
bList.add(a.getB());
}
I think it should be a mix of following things:
aList.forEach((b -> a.getB());
or
aList.forEach(bList::add);
But I can't mix these two to obtain the desired output.