Class CollectionUtils.CardinalityHelper<O>

java.lang.Object
org.apache.commons.collections4.CollectionUtils.CardinalityHelper<O>
Type Parameters:
O - the element type
Direct Known Subclasses:
CollectionUtils.SetOperationCardinalityHelper
Enclosing class:
CollectionUtils

private static class CollectionUtils.CardinalityHelper<O> extends Object
Helper class to easily access cardinality properties of two collections.
  • Field Details

    • cardinalityA

      final Map<O,Integer> cardinalityA
      Contains the cardinality for each object in collection A.
    • cardinalityB

      final Map<O,Integer> cardinalityB
      Contains the cardinality for each object in collection B.
  • Constructor Details

    • CardinalityHelper

      public CardinalityHelper(Iterable<? extends O> a, Iterable<? extends O> b)
      Create a new CardinalityHelper for two collections.
      Parameters:
      a - the first collection
      b - the second collection
  • Method Details

    • max

      public final int max(Object obj)
      Returns the maximum frequency of an object.
      Parameters:
      obj - the object
      Returns:
      the maximum frequency of the object
    • min

      public final int min(Object obj)
      Returns the minimum frequency of an object.
      Parameters:
      obj - the object
      Returns:
      the minimum frequency of the object
    • freqA

      public int freqA(Object obj)
      Returns the frequency of this object in collection A.
      Parameters:
      obj - the object
      Returns:
      the frequency of the object in collection A
    • freqB

      public int freqB(Object obj)
      Returns the frequency of this object in collection B.
      Parameters:
      obj - the object
      Returns:
      the frequency of the object in collection B
    • getFreq

      private int getFreq(Object obj, Map<?,Integer> freqMap)