Class FrequencyMap<T>

Object
FrequencyMap<T>
Type Parameters:
T - key-type (should have Object.toString() representation that is meaningful to humans)

public class FrequencyMap<T> extends Object
Counts the frequency of certain strings, and describes the contents in human language.
Author:
Owen Feehan
  • Constructor Details

    • FrequencyMap

      public FrequencyMap()
  • Method Details

    • incrementCount

      public void incrementCount(T key)
      Increments the count for a given key.
      Parameters:
      key - the key whose count should be incremented
    • describe

      public String describe(String noun)
      Describes the frequency map contents in human-readable language.
      Parameters:
      noun - the noun to use in the description (e.g., "color", "shape")
      Returns:
      a String describing the contents of the frequency map