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 Set
UNIVERSAL_SET
-
Method Summary
Modifier and Type Method Description boolean
add(Object o)
boolean
addAll(Collection<? extends T> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object other)
boolean
isEmpty()
Iterator<T>
iterator()
boolean
remove(Object o)
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>
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:
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)
-