I have an empty list of integers:
final List<Integer> reservedMarkers = new ArrayList<>();
and I will fill this list with the marker property of a list of objects, such like this:
scheduleIntervalContainers.stream().forEach(s -> s.getMarker(), reservedMarkers.add(s));
My final target would be to get the highest marker number but actually I dont know a better way as getting all marker numbers, than sort it and than get the highest one.
this does not work for sure, is there a possibility to do this in this way?
forEach. And there is a documented API. Look there first.