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:
java.io.Serializable, java.lang.Iterable<T>, java.util.Collection<T>

public class DualCollection<T>
extends java.util.AbstractCollection<T>
implements java.io.Serializable

A combination of two collections into a collection.

Since:
3.0.0
Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
DualCollection(java.util.Collection<T> first, java.util.Collection<T> second)
          Constructor.
 
Method Summary
static
<M> java.util.Collection<M>
combine(java.util.Collection<M> first, java.util.Collection<M> second)
          Returns a collection by combining two collections.
 java.util.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(java.util.Collection<T> first,
                      java.util.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> java.util.Collection<M> combine(java.util.Collection<M> first,
                                                        java.util.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 java.util.Collection<T>
Specified by:
size in class java.util.AbstractCollection<T>

iterator

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


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo