Package org.zkoss.util

## Class DualCollection<T>

- java.lang.Object
- - java.util.AbstractCollection<T>
  - - 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

    Constructors
    Constructor | Description
    --- | ---
    `DualCollection​(java.util.Collection<T> first, java.util.Collection<T> second)` | Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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, parallelStream, removeIf, spliterator, stream, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### 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<M>, java.util.Collection<M>)` 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.util.Collection<T>`
      Specified by:
        `iterator` in interface `java.lang.Iterable<T>`
      Specified by:
        `iterator` in class `java.util.AbstractCollection<T>`