previous | start | next

The Trie get Method

public V get(final String key) {
  final Node<V> x = get(root, key, 0);
  if (x == null) return null;
  return x.val;
}

private Node<V> get(final Node<V> x, final String key, final int d) {
  if (x == null) return null;
  if (d == key.length()) return x;
  final char c = key.charAt(d);
  return get(x.next[c], key, d+1);
}


previous | start | next