java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.aoapps.collections.UnionMethodSet<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
A union set that assumes objects of different classes are not equal. It obtains
the objects by invoking the provided methods. The provided methods will be invoked
on an as-needed basis. It never does any combining.
The following assumptions are made:
- All elements of the returned sets are of the same exact class (within a single method)
- Objects of different classes are not equal.
- No set will contain
null
- Author:
- AO Industries, Inc.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classstatic classA set of values will be obtained from the call to the method.static classA single value will be obtained from the call to the method. -
Constructor Summary
ConstructorsConstructorDescriptionUnionMethodSet(Object target, Class<E> classE, Map<Class<? extends E>, ? extends List<? extends UnionMethodSet.Method<? extends E>>> methodsByClass) -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, 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, addAll, clear, containsAll, remove, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
UnionMethodSet
-
-
Method Details
-
size
public int size()This is an expensive operation, since every single method is called, and when there are multiple methods for one class, the sets must be merged to avoid redundant values.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()Checks if this set is empty. This can be an expensive method since it can potentially call all methods.- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
iterator
-
