Map<Boolean, List<Integer>> results=
List1.stream().collect(Collectors.partitioningBy( n -> n < 0));
I think that this one is prettier and easy to read. (You can then get the negative and non-negative list from the map.)
Map<Boolean, List<Integer>> results=
List1.stream().collect(Collectors.partitioningBy( n -> n < 0));
I think that this one is prettier and easy to read. (You can then get the negative and non-negative list from the map.)