GuavaUtils { public static <T> Collector<T, ?, ImmutableSet<T>> toImmutableSet() { return Collector.of( ImmutableSet.Builder<T>::new, ImmutableSet.Builder::add, (l, r) -> l.addAll(r.build()), ImmutableSet.Builder::build, UNORDERED); } private  GuavaUtils(); static Collector<T, ?, ImmutableSet<T>> toImmutableSet(); static Collector<T, ?, ImmutableList<T>> toImmutableList(); static ServiceManagerIface serviceManager(final ServiceManager delegate);  }
@Test public void testToImmutableSet() { assertEquals( ImmutableSet.of("b", "c", "a"), ImmutableList.of("a", "b", "c").stream().collect(GuavaUtils.toImmutableSet())); }