public V remove(K key){
  if (key == null) {
    throw new NullPointerException("Key must not be null!!!");
  }
  final Iterator<P> it=key.iterator();
  final Stack<Node<P,V>> stack=new Stack<Node<P,V>>();
  Node<P,V> parent=null;
  Node<P,V> node=this.root;
  while (it.hasNext()) {
    final P keyPart=it.next();
    final Node<P,V> child=node.getChildWithNull(keyPart);
    if (child == null) {
      return null;
    }
 else {
      stack.push(node);
      parent=node;
      node=child;
    }
  }
  if (!stack.isEmpty()) {
    stack.pop();
  }
  final V result=node.value;
  V propagatedValue;
  if (node.isLeaf) {
    node.isLeaf=false;
    propagatedValue=updateNode(parent,node,true,null);
  }
 else {
    return null;
  }
  Node<P,V> child=null;
  while (!stack.isEmpty()) {
    child=node;
    node=parent;
    parent=stack.pop();
    node.leafCount-=1;
    final boolean updateAfterRemove=(node.getChildWithNull(child.keyPart) == null);
    propagatedValue=updateNode(parent,node,updateAfterRemove,propagatedValue);
  }
  this.size-=1;
  return result;
}

public V remove ( K key ) { if ( key == null ) { throw new NullPointerException ( "Key must not be null!!!" ) ; } final Iterator < P > it = key . iterator ( ) ; final Stack < Node < P , V > > stack = new Stack < Node < P , V > > ( ) ; Node < P , V > parent = null ; Node < P , V > node = this . root ; while ( it . hasNext ( ) ) { final P keyPart = it . next ( ) ; final Node < P , V > child = node . getChildWithNull ( keyPart ) ; if ( child == null ) { return null ; } else { stack . push ( node ) ; parent = node ; node = child ; } } if ( ! stack . isEmpty ( ) ) { stack . pop ( ) ; } final V result = node . value ; V propagatedValue ; if ( node . isLeaf ) { node . isLeaf = false ; propagatedValue = updateNode ( parent , node , true , null ) ; } else { return null ; } Node < P , V > child = null ; while ( ! stack . isEmpty ( ) ) { child = node ; node = parent ; parent = stack . pop ( ) ; node . leafCount -= 1 ; final boolean updateAfterRemove = ( node . getChildWithNull ( child . keyPart ) == null ) ; propagatedValue = updateNode ( parent , node , updateAfterRemove , propagatedValue ) ; } this . size -= 1 ; return result ; }
removes the given value from the tree
