public void incrementWordCounter ( String word ) { if ( vocabulary . containsKey ( word ) ) { vocabulary . get ( word ) . incrementCount ( ) ; } // there's no need to throw such exception here. just do nothing if word is not found //else throw new IllegalStateException("No such word found"); }
Increments by one number of occurrences of the word in corpus