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>
public class UniversalSet<T> extends Object implements Set<T>, Serializable
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:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static SetUNIVERSAL_SET -
Method Summary
Modifier and Type Method Description booleanadd(Object o)booleanaddAll(Collection<? extends T> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object other)booleanisEmpty()Iterator<T>iterator()booleanremove(Object o)booleanremoveAll(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>universalSet()
-
Field Details
-
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)
-