Class CollectionUtils.SetOperationCardinalityHelper<O>

java.lang.Object
org.apache.commons.collections4.CollectionUtils.CardinalityHelper<O>
org.apache.commons.collections4.CollectionUtils.SetOperationCardinalityHelper<O>
Type Parameters:
O - the element type
All Implemented Interfaces:
Iterable<O>
Enclosing class:
CollectionUtils

private static class CollectionUtils.SetOperationCardinalityHelper<O> extends CollectionUtils.CardinalityHelper<O> implements Iterable<O>
Helper class for set-related operations, e.g. union, subtract, intersection.
  • Field Details

    • elements

      private final Set<O> elements
      Contains the unique elements of the two collections.
    • newList

      private final List<O> newList
      Output collection.
  • Constructor Details

    • SetOperationCardinalityHelper

      public SetOperationCardinalityHelper(Iterable<? extends O> a, Iterable<? extends O> b)
      Create a new set operation helper from the two collections.
      Parameters:
      a - the first collection
      b - the second collection
  • Method Details

    • iterator

      public Iterator<O> iterator()
      Specified by:
      iterator in interface Iterable<O>
    • setCardinality

      public void setCardinality(O obj, int count)
      Add the object count times to the result collection.
      Parameters:
      obj - the object to add
      count - the count
    • list

      public Collection<O> list()
      Returns the resulting collection.
      Returns:
      the result