src/Datastructure/Cache/LRUCache.php
public function delete($key): bool {
        $node = $this->getNodeFromHead($key);
        if (null === $node) {
            return false;
        }
        /** @var Node $head */
        $head = $this->head;
        while (null !== $head) {
            if (Comparator::equals($head->getKey(), $node->getKey())) {
                $this->unset($head);
                $this->hashMap->remove($key);
                return true;
            }
            $head = $head->getNext();
        }
        return false;
    }
public function delete($key): bool {
        $node = $this->getNodeFromHead($key);
        if (null === $node) {
            return false;
        }
        /** @var Node $head */
        $head = $this->head;
        while (null !== $head) {
            if (Comparator::equals($head->getKey(), $node->getKey())) {
                $this->unset($head);
                $this->hashMap->remove($key);
                return true;
            }
            $head = $head->getNext();
        }
        return false;
    }
public function delete ( $ key ) : bool { $ node = $ this -> getNodeFromHead ( $ key ) ; if ( null === $ node ) { return false ; } /** @var Node $head */ $ head = $ this -> head ; while ( null !== $ head ) { if ( Comparator :: equals ( $ head -> getKey ( ) , $ node -> getKey ( ) ) ) { $ this -> unset ( $ head ) ; $ this -> hashMap -> remove ( $ key ) ; return true ; } $ head = $ head -> getNext ( ) ; } return false ; }
deletes a given key

@param $key
@return bool
@throws \doganoo\PHPAlgorithms\common\Exception\InvalidKeyTypeException
@throws \doganoo\PHPAlgorithms\common\Exception\UnsupportedKeyTypeException
deletes a given key