I would like to replace the following code to utilize Java 8 streams if possible:
final List<Long> myIds = new ArrayList<>();
List<Obj> myObjects = new ArrayList<>();
// myObject populated...
for (final Obj ob : myObjects) {
myIds.addAll(daoClass.findItemsById(ob.getId()));
}
daoClass.findItemsById returns List<Long>
Can anybody advise the best way to do this via lambdas? Many thanks.