_Sets { public static <T> Set<T> unmodifiable(@Nullable Iterable<T> iterable) { if(iterable==null) { return Collections.emptySet(); } return _NullSafe.stream(iterable) .collect(toUnmodifiable(LinkedHashSet::new)); }  static Set<T> singleton(T element); static Set<T> singletonOrElseEmpty(@Nullable T element); @SafeVarargs static Set<T> of(T ... elements); @SafeVarargs static SortedSet<T> ofSorted(T ... elements); static Set<T> unmodifiable(@Nullable Iterable<T> iterable); static TreeSet<T> newTreeSet(); static TreeSet<T> newTreeSet(@Nullable Comparator<T> comparator); static TreeSet<T> newTreeSet(@Nullable Iterable<T> iterable); static TreeSet<T> newTreeSet(@Nullable Iterable<T> iterable, @Nullable Comparator<T> comparator); static HashSet<T> newHashSet(); static HashSet<T> newHashSet(@Nullable Collection<T> collection); static HashSet<T> newHashSet(@Nullable Iterable<T> iterable); static LinkedHashSet<T> newLinkedHashSet(); static LinkedHashSet<T> newLinkedHashSet(@Nullable Collection<T> collection); static LinkedHashSet<T> newLinkedHashSet(@Nullable Iterable<T> iterable); static KeySetView<T, Boolean> newConcurrentHashSet(); static KeySetView<T, Boolean> newConcurrentHashSet(@Nullable Collection<T> collection); static KeySetView<T, Boolean> newConcurrentHashSet(@Nullable Iterable<T> iterable); static CopyOnWriteArraySet<T> newCopyOnWriteArraySet(); static CopyOnWriteArraySet<T> newCopyOnWriteArraySet(@Nullable Collection<T> collection); static CopyOnWriteArraySet<T> newCopyOnWriteArraySet(@Nullable Iterable<T> iterable); static Set<T> intersect(@Nullable Set<T> a, @Nullable Set<T> b); static SortedSet<T> intersectSorted(@Nullable SortedSet<T> a, @Nullable SortedSet<T> b); static Set<T> minus(@Nullable Set<T> a, @Nullable Set<T> b); static SortedSet<T> minusSorted(@Nullable SortedSet<T> a, @Nullable SortedSet<T> b); static Set<T> minus(
            @Nullable Set<T> a, 
            @Nullable Set<T> b, 
            @NonNull Supplier<Set<T>> collectionFactory); static SortedSet<T> minusSorted(
            @Nullable SortedSet<T> a, 
            @Nullable SortedSet<T> b, 
            @NonNull Supplier<SortedSet<T>> collectionFactory); static Collector<T, ?, Set<T>> toUnmodifiable(Supplier<Set<T>> collectionFactory); static Collector<T, ?, Set<T>> toUnmodifiable(); static Collector<T, ?, Set<T>> toUnmodifiablePreservingOrder(); static Collector<T, ?, SortedSet<T>> toUnmodifiableSorted(Supplier<SortedSet<T>> collectionFactory); static Collector<T, ?, SortedSet<T>> toUnmodifiableSorted();  }
@Test void testUnmodifiable() { val set = _Sets.unmodifiable(Samples.iterable(3, 1, 2)); assertUnmodifiable(set); Samples.assertListEquals(_Lists.of(3, 1, 2), set); }