Stream.distinct() is redundant before toSet() collector. Duplicates will be collapsed by Collector.
Stream.sorted() is redundant before toMap() collector. Keys will be shuffled by Collector (it's a HashMap in current implementation)
Stream.sorted() is redundant before toMap() collector. Keys will be shuffled by Collector (it's a HashMap in current implementation)