Collects a stream into an immutable set sorted in natural order
()
| 48 | |
| 49 | /** Collects a stream into an immutable set sorted in natural order */ |
| 50 | public static <T extends Comparable<? super T>> Collector<T, ?, Set<T>> toSortedSet() { |
| 51 | return collectingAndThen(toCollection(TreeSet::new), Collections::unmodifiableSet); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Collects stream to immutable set that keeps elements in the same order as the original stream |
no outgoing calls