org.zkoss.util
Class DualCollection<T>

java.lang.Object
  extended by java.util.AbstractCollection<T>
      extended by org.zkoss.util.DualCollection<T>
All Implemented Interfaces:
Serializable, Iterable<T>, Collection<T>

public class DualCollection<T>
extends AbstractCollection<T>
implements Serializable

A combination of two collections into a collection.

Since:
3.0.0
Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
DualCollection(Collection<T> first, Collection<T> second)
          Constructor.
 
Method Summary
static
<M> Collection<M>
combine(Collection<M> first, Collection<M> second)
          Returns a collection by combining two collections.
 Iterator<T> iterator()
           
 int size()
           
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

DualCollection

public DualCollection(Collection<T> first,
                      Collection<T> second)
Constructor. It is better to use combine(java.util.Collection, java.util.Collection) instead of this method since it checks whether any of them is null or equals.

Method Detail

combine

public static final <M> Collection<M> combine(Collection<M> first,
                                              Collection<M> second)
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:
size in interface Collection<T>
Specified by:
size in class AbstractCollection<T>

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>
Specified by:
iterator in interface Collection<T>
Specified by:
iterator in class AbstractCollection<T>


Copyright © 2013. All rights reserved.