Java Collectors.groupingBy()—is List ordered?
The documentation for groupingBy() says: Implementation Requirements: This produces a result similar to: groupingBy(classifier, toList()); The documentation for toList() says: Returns: a Collector which collects all the input elements into a List, in encounter order So, to answer your question, as long as your stream has a defined encounter order, you’re guaranteed to get ordered … Read more