I want to make the second part work thanks for the help:)
If arraylist is ['A','a','B','C','C'] then dups:['A','a','C','C'] nondups: ['B'] I tried :
Map<String, Long> counts = nums.parallelStream()
.collect( Collectors.groupingBy( {k -> k.toLowerCase()}, Collectors.counting()) )
It gives counts: {a:2, b:1, c:2}
Now I am finding dups and nondups which is done by below code or alternate suggestion to solve this:
Map<Boolean, List<String>> hasDup =
counts.entrySet().parallelStream()
.collect(Collectors.partitioningBy(
entry -> entry.getValue() > 1,
Collectors.mapping(Map.Entry::getKey, Collectors.toList())));
List<String> dup = hasDup.get(true);
List<String> nodup = hasDup.get(false);
dup:['a','c'] nondups:['b'] I need help in second part because the expected output is not the same as I want which is
dups:['A','a','C','C'] nondups: ['B']