Class Counter<T>

java.lang.Object
org.apache.wayang.core.util.Counter<T>
All Implemented Interfaces:
Iterable<Map.Entry<T,Integer>>

public class Counter<T> extends Object implements Iterable<Map.Entry<T,Integer>>
This utility helps to count elements.
  • Constructor Details

    • Counter

      public Counter()
  • Method Details

    • get

      public int get(T element)
    • add

      public int add(T element, int delta)
      Counts the given delta for the given element.
      Returns:
      the new count
    • increment

      public int increment(T element)
    • decrement

      public int decrement(T element)
    • addAll

      public void addAll(Counter<T> that)
    • isEmpty

      public boolean isEmpty()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • iterator

      public Iterator<Map.Entry<T,Integer>> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • remove

      public void remove(T element)
    • clear

      public void clear()