public TrieBuilder < T > add ( String word , T value ) { assertNotEmptyWord ( word ) ; // Save the word-value pair in the map. The actual construction will be done later. if ( map . containsKey ( word ) ) { throw new IllegalArgumentException ( "Trie already contains a value for '" + word + "': " + map . get ( word ) ) ; } map . put ( word , value ) ; return this ; }
Add a word - value mapping to the Trie . Expects there not to be a previous mapping for the word .