public TrieBuilder addWord ( @ Nonnull final String word ) { Objects . requireNonNull ( word ) ; final int length = word . length ( ) ; if ( length == 0 ) throw new IllegalArgumentException ( "a trie cannot have empty " + "strings (use EMPTY instead)" ) ; nrWords ++ ; maxLength = Math . max ( maxLength , length ) ; nodeBuilder . addWord ( word ) ; return this ; }
Add one word to the trie