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 Bag<O> cardinalityA
      Contains the cardinality for each object in collection A.
    • cardinalityB

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

    • CardinalityHelper

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

    • equals

      static boolean equals(Collection<?> a, Collection<?> b)
    • freqA

      public int freqA(Object key)
      Gets the frequency of this object in collection A.
      Parameters:
      key - the key whose associated frequency is to be returned.
      Returns:
      the frequency of the object in collection A
    • freqB

      public int freqB(Object key)
      Gets the frequency of this object in collection B.
      Parameters:
      key - the key whose associated frequency is to be returned.
      Returns:
      the frequency of the object in collection B
    • getFreq

      private int getFreq(Object key, Bag<?> freqMap)
    • max

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

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