Class Jdk8UnmodifiableSetFactory
- java.lang.Object
-
- pl.tlinkowski.unij.service.collect.jdk8.Jdk8UnmodifiableSetFactory
-
- All Implemented Interfaces:
UnmodifiableSetFactory
@AutoService(pl.tlinkowski.unij.service.api.collect.UnmodifiableSetFactory.class) public final class Jdk8UnmodifiableSetFactory extends Object implements UnmodifiableSetFactory
Implementation ofUnmodifiableSetFactoryfollowing the JDK 11 unmodifiable sets specification (e.g. nonullelements allowed, throwsIllegalArgumentExceptionon duplicate elements provided toof(...)methods).This implementation returns either a
HashSetwrapped byCollections.unmodifiableSet(java.util.Set<? extends T>)or aCollections.singleton(T).- Author:
- Tomasz Linkowski
-
-
Constructor Summary
Constructors Constructor Description Jdk8UnmodifiableSetFactory()
-
Method Summary
Modifier and Type Method Description <E> Collector<E,?,Set<E>>collector()Based onCollectors.toUnmodifiableSet().<E> Set<E>copyOf(Collection<? extends E> coll)Based onSet.copyOf(Collection).<E> Set<E>of()<E> Set<E>of(E e1)<E> Set<E>of(E... elements)Based onSet.of(Object[]).<E> Set<E>of(E e1, E e2)<E> Set<E>of(E e1, E e2, E e3)<E> Set<E>of(E e1, E e2, E e3, E e4)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E e6)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)<E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10)
-
-
-
Method Detail
-
collector
public <E> Collector<E,?,Set<E>> collector()
Based onCollectors.toUnmodifiableSet().- Specified by:
collectorin interfaceUnmodifiableSetFactory
-
copyOf
public <E> Set<E> copyOf(Collection<? extends E> coll)
Based onSet.copyOf(Collection).- Specified by:
copyOfin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of()
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5, @NonNull E e6)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5, @NonNull E e6, @NonNull E e7)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5, @NonNull E e6, @NonNull E e7, @NonNull E e8)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5, @NonNull E e6, @NonNull E e7, @NonNull E e8, @NonNull E e9)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
public <E> Set<E> of(@NonNull E e1, @NonNull E e2, @NonNull E e3, @NonNull E e4, @NonNull E e5, @NonNull E e6, @NonNull E e7, @NonNull E e8, @NonNull E e9, @NonNull E e10)
- Specified by:
ofin interfaceUnmodifiableSetFactory
-
of
@SafeVarargs public final <E> Set<E> of(E... elements)
Based onSet.of(Object[]).- Specified by:
ofin interfaceUnmodifiableSetFactory
-
-