code: private void addNode(final TrieNode<V> node, final CharSequence key,
                           final int beginIndex, final TrieNode<V> newNode) {
          final int lastKeyIndex = key.length() - 1;
          TrieNode<V> currentNode = node;
          int i = beginIndex;
  
          for (; i < lastKeyIndex; i++) {
              final TrieNode<V> nextNode = new TrieNode<V>(false);
              currentNode.children.put(key.charAt(i), nextNode);
              currentNode = nextNode;
          }
  
          currentNode.children.put(key.charAt(i), newNode);
      }
docs: Adds the given new node to the node with the given key beginning at
  beginIndex.