java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.aoapps.collections.UnionClassSet<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
A union set that assumes objects of different classes are not equal. It never
does any combining.
The following assumptions are made:
- All elements of the added sets are of the same exact class
- Objects of different classes are not equal.
- No set will contain
null - A set for a specific class may only be added once.
- Sets that have been added do not change after being added.
- Only sets will be added.
- Nothing will be removed (except clear is supported).
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorsConstructorDescriptionUnionClassSet(Collection<? extends E> c) UnionClassSet(Set<? extends E> set) -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
add, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
add, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
UnionClassSet
public UnionClassSet() -
UnionClassSet
-
UnionClassSet
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
iterator
-
addAll
Must be a set.- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>- See Also:
-
addAll
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
