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 TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> c) voidclear()booleanbooleancontainsAll(Collection<?> c) final booleanbooleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) static booleansafeEquals(Set a, Set b) Safely compare two Sets, one of which may be a UniversalSet.intsize()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, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceSet<T>
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
toArray
public <T> T[] toArray(@NotNull T[] a)
-