* @param val the value
     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>
     */
    public void put(Key key, Value val) {
        if (key == null) throw new NullPointerException("called put() with null key");
	//if (val == null) return delete(key); // restore this once delete is implemented.
	Node add = new Node();
	add.key = key;
	add.value = val;
	if (first == null)
	    first = add;
	else {
            Node n = first;
            while (true) {
                if (key.compareTo(n.key) < 0) {
                    if (n.left == null) {
                        n.left = add;
                        return;
                    }
                    n = n.left;
                }
                else if (key.compareTo(n.key) > 0) {
                    if (n.right == null) {
                        n.right = add;
                        return;
                    }
                    n = n.right;
                }
                else {
                    n.value = val;
                    return;
                }
            }
        }
    }