While learning Java 8 streams and lambas, I tried to replace the following nested for loops with streams :
List deskIds = new ArrayList<>()
I would probably write it like this:
List<Long> deskIds = service.getAllNodesDepthFirst().stream() .flatMap(p -> p.getDesks().stream()) .map(Desk::getId) .collect(toList());