@Override
    public V add(String key, V value)
    {
        if (key == null || value == null)
        {
            throw new IllegalArgumentException();
        }
        Node<V> node = root;
        int length = key.length();
        for (int i = 0; i < length; ++i)
        {
            char c = key.charAt(i);
            if (!valid(c))
            {
                throw new IllegalArgumentException();
            }
            if (node.next[c] == null)
            {
                node.next[c] = new Node<V>();
            }
            node = node.next[c];
        }
        V old = node.value;
        node.value = value;
        if (old == null)
        {
            ++size;
        }
        return old;
    }