Stream.toList() vs Collectors.toList() in modern Java?

Public API return users.stream().filter(...).toList() — immutable contract. Internal processing needing mutation: collect(Collectors.toList()). Java 21+...

Stream.toList() vs Collectors.toList() in modern Java? · Home · Support the platform