Package org.zkoss.util
Class DualCollection<T>
java.lang.Object
java.util.AbstractCollection<T>
org.zkoss.util.DualCollection<T>
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>
A combination of two collections into a collection.
- Since:
- 3.0.0
- Author:
- tomyeh
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final <M> Collection<M>combine(Collection<M> first, Collection<M> second) Returns a collection by combining two collections.iterator()intsize()Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
DualCollection
Constructor. It is better to usecombine(java.util.Collection<M>, java.util.Collection<M>)instead of this method since it checks whether any of them is null or equals.
-
-
Method Details
-
combine
Returns a collection by combining two collections. It checks whether any of them is null, or equals. And, returns the non-null one if another is null. If both null, it returns null. -
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein classAbstractCollection<T>
-
iterator
- Specified by:
iteratorin interfaceCollection<T>- Specified by:
iteratorin interfaceIterable<T>- Specified by:
iteratorin classAbstractCollection<T>
-