void () { Object map1 = Stream.of(1, 2, 3, 4).map(String::valueOf) .collect(Collectors.partitioningBy(x -> x.length() > 1)); Map<Boolean, List<String>> map2 = Stream.of(1, 2, 3, 4).map(String::valueOf) .collect(Collectors.partitioningBy((String x) -> x.length() > 1)); }