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
ConstructorDescriptionUnionClassSet
(Collection<? extends E> c) UnionClassSet
(Set<? extends E> set) -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
add, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
iterator
-
addAll
Must be a set.- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceSet<E>
- Overrides:
addAll
in classAbstractCollection<E>
- See Also:
-
addAll
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in classAbstractCollection<E>
-