public static void addToTrie(TrieNode root,String str,String value){
  int index=0;
  while (index < str.length()) {
    root=root.getOrCreateChild(str.charAt(index++));
  }
  root.setValue(value);
}

public static void addToTrie ( TrieNode root , String str , String value ) { int index = 0 ; while ( index < str . length ( ) ) { root = root . getOrCreateChild ( str . charAt ( index ++ ) ) ; } root . setValue ( value ) ; }
adds the given string into the trie .
