java.lang.ObjectWordFrequencyList
public class WordFrequencyList
Constructor Summary | |
---|---|
WordFrequencyList()
Constructs a new WordFrequencyList object, with an empty list of WordCounts |
Method Summary | |
---|---|
void |
add(java.lang.String word)
Adds the specified word into the list. |
WordCount |
get(int index)
Returns Word at the specified position in the list. |
WordCount |
mostFrequent()
Returns the most frequent word in the list. |
int |
numberOfWords()
Returns the number of unique words in the list. |
WordFrequencyList |
occursMoreThan(int n)
Returns a list of all words that occur more than N times. |
int |
totalWords()
Returns the total number of words in the list. |
int |
wordCount(java.lang.String word)
Returns the number of times the specified word occurs |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WordFrequencyList()
Method Detail |
---|
public void add(java.lang.String word)
word
- The word to be added.public WordCount get(int index)
index
- the index of the element to return.
public WordCount mostFrequent()
public int numberOfWords()
public WordFrequencyList occursMoreThan(int n)
n
- Threshold; all words that occur more than n times will be returned.
public int totalWords()
public int wordCount(java.lang.String word)
word
- the word whose count is desired