@Test public void testToNaturalImmutableSortedSet_Sort() { List<String> vals = Arrays.asList("charlie", "bravo", "delta", "india", "echo", "alpha"); ImmutableSet<String> res = vals.stream().collect(toNaturalImmutableSortedSet()); assertEquals("[alpha, bravo, charlie, delta, echo, india]", res.toString()); }
public static <T extends Comparable<?>> Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet() { Supplier<ImmutableSortedSet.Builder<T>> supplier = ImmutableSortedSet::naturalOrder; BiConsumer<ImmutableSortedSet.Builder<T>, T> accumulator = (b, v) -> b.add(v); BinaryOperator<ImmutableSortedSet.Builder<T>> combiner = (l, r) -> l.addAll(r.build()); Function<ImmutableSortedSet.Builder<T>, ImmutableSortedSet<T>> finisher = ImmutableSortedSet.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); }
Gullectors { public static <T extends Comparable<?>> Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet() { Supplier<ImmutableSortedSet.Builder<T>> supplier = ImmutableSortedSet::naturalOrder; BiConsumer<ImmutableSortedSet.Builder<T>, T> accumulator = (b, v) -> b.add(v); BinaryOperator<ImmutableSortedSet.Builder<T>> combiner = (l, r) -> l.addAll(r.build()); Function<ImmutableSortedSet.Builder<T>, ImmutableSortedSet<T>> finisher = ImmutableSortedSet.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); } }
Gullectors { public static <T extends Comparable<?>> Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet() { Supplier<ImmutableSortedSet.Builder<T>> supplier = ImmutableSortedSet::naturalOrder; BiConsumer<ImmutableSortedSet.Builder<T>, T> accumulator = (b, v) -> b.add(v); BinaryOperator<ImmutableSortedSet.Builder<T>> combiner = (l, r) -> l.addAll(r.build()); Function<ImmutableSortedSet.Builder<T>, ImmutableSortedSet<T>> finisher = ImmutableSortedSet.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); }  }
Gullectors { public static <T extends Comparable<?>> Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet() { Supplier<ImmutableSortedSet.Builder<T>> supplier = ImmutableSortedSet::naturalOrder; BiConsumer<ImmutableSortedSet.Builder<T>, T> accumulator = (b, v) -> b.add(v); BinaryOperator<ImmutableSortedSet.Builder<T>> combiner = (l, r) -> l.addAll(r.build()); Function<ImmutableSortedSet.Builder<T>, ImmutableSortedSet<T>> finisher = ImmutableSortedSet.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); }  static Collector<T, ?, ImmutableList<T>> toImmutableList(); static Collector<T, ?, ImmutableSet<T>> toImmutableSet(); static Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet(); static Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
			Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper); }
Gullectors { public static <T extends Comparable<?>> Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet() { Supplier<ImmutableSortedSet.Builder<T>> supplier = ImmutableSortedSet::naturalOrder; BiConsumer<ImmutableSortedSet.Builder<T>, T> accumulator = (b, v) -> b.add(v); BinaryOperator<ImmutableSortedSet.Builder<T>> combiner = (l, r) -> l.addAll(r.build()); Function<ImmutableSortedSet.Builder<T>, ImmutableSortedSet<T>> finisher = ImmutableSortedSet.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); }  static Collector<T, ?, ImmutableList<T>> toImmutableList(); static Collector<T, ?, ImmutableSet<T>> toImmutableSet(); static Collector<T, ?, ImmutableSortedSet<T>> toNaturalImmutableSortedSet(); static Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
			Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper);  }