Package io.deephaven.util
Class UniversalSet<T>
java.lang.Object
io.deephaven.util.UniversalSet<T>
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Collection<T>
,Set<T>
A universal
Set
that's acts as if all values are contained therein. The only supported operations are:
Set.isEmpty()
Set.contains(Object)
Set.containsAll(Collection)
Any other operations return an UnsupportedOperationException
.
Note that you can't use equals on a Set and a UniversalSet, because the Set's implementation will call unsupported
methods from UniversalSet. If one of your Sets may be a universal set, use safeEquals(Set, Set)
instead.- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends T> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) final boolean
boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) static boolean
safeEquals
(Set a, Set b) Safely compare two Sets, one of which may be a UniversalSet.int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) static <T> Set<T>
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
hashCode, spliterator
-
Field Details
-
UNIVERSAL_SET
-
-
Method Details
-
safeEquals
Safely compare two Sets, one of which may be a UniversalSet. -
universalSet
-
equals
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
toArray
public <T> T[] toArray(@NotNull T[] a)
-