- java.lang.Object
-
- net.morimekta.collect.UnmodifiableCollection<E>
-
- net.morimekta.collect.UnmodifiableSet<E>
-
- Type Parameters:
E
- The set element type.
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
public final class UnmodifiableSet<E> extends UnmodifiableCollection<E> implements Set<E>
Simple immutable set. This set is order-preserving, so when iterating the elements, they will come in the same order as added. If same value was added multiple times, the first entry counts.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnmodifiableSet.Builder<E>
-
Field Summary
-
Fields inherited from class net.morimekta.collect.UnmodifiableCollection
array, length, offset
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E> UnmodifiableSet<E>
asSet(E... array)
static <E> UnmodifiableSet<E>
asSet(Iterable<? extends E> iterable)
static <E> UnmodifiableSet<E>
asSet(Collection<? extends E> collection)
static <E> UnmodifiableSet<E>
asSet(Enumeration<? extends E> enumeration)
static <E> UnmodifiableSet<E>
asSet(Iterator<? extends E> iterator)
boolean
contains(Object o)
boolean
equals(Object obj)
UnmodifiableSet<E>
filtered(Predicate<? super E> predicate)
Get list with only the items matching the predicate.int
hashCode()
static <E> UnmodifiableSet.Builder<E>
newBuilder()
static <E> UnmodifiableSet.Builder<E>
newBuilder(int initialCapacity)
static <E> UnmodifiableSet<E>
setOf()
static <E> UnmodifiableSet<E>
setOf(E e)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5, E e6)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)
static <E> UnmodifiableSet<E>
setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E... more)
static <E> Collector<E,?,UnmodifiableSet<E>>
toSet()
String
toString()
-
Methods inherited from class net.morimekta.collect.UnmodifiableCollection
add, addAll, append, append, append, asList, clear, containsAll, isEmpty, iterator, map, orderedSetBy, remove, removeAll, removeIf, retainAll, reversed, size, sorted, sortedBy, toArray, toArray, toArray, unmodifiable
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
toSet
public static <E> Collector<E,?,UnmodifiableSet<E>> toSet()
-
asSet
@SafeVarargs public static <E> UnmodifiableSet<E> asSet(E... array)
-
asSet
public static <E> UnmodifiableSet<E> asSet(Iterable<? extends E> iterable)
-
asSet
public static <E> UnmodifiableSet<E> asSet(Iterator<? extends E> iterator)
-
asSet
public static <E> UnmodifiableSet<E> asSet(Enumeration<? extends E> enumeration)
-
asSet
public static <E> UnmodifiableSet<E> asSet(Collection<? extends E> collection)
-
setOf
public static <E> UnmodifiableSet<E> setOf()
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5, E e6)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)
-
setOf
public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)
-
setOf
@SafeVarargs public static <E> UnmodifiableSet<E> setOf(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E... more)
-
newBuilder
public static <E> UnmodifiableSet.Builder<E> newBuilder()
-
newBuilder
public static <E> UnmodifiableSet.Builder<E> newBuilder(int initialCapacity)
-
equals
public boolean equals(Object obj)
-
hashCode
public int hashCode()
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classUnmodifiableCollection<E>
-
filtered
public UnmodifiableSet<E> filtered(Predicate<? super E> predicate)
Get list with only the items matching the predicate.- Specified by:
filtered
in classUnmodifiableCollection<E>
- Parameters:
predicate
- The predicate to keep item in response.- Returns:
- The filtered list.
-
-