src/Datastructure/Maps/HashMap.php
public function getNodeByKey($key): ?Node {
        $arrayIndex = $this->getBucketIndex($key);
        /*
         * the list is requested from the array based on
         * the array index hash.
         */
        /** @var SinglyLinkedList $list */
        if (!isset($this->bucket[$arrayIndex])) {
            return null;
        }
        $list = $this->bucket[$arrayIndex];
        if (!$list->containsKey($key)) {
            return null;
        }
        $node = $list->getNodeByKey($key);
        return $node;
    }
public function getNodeByKey($key): ?Node {
        $arrayIndex = $this->getBucketIndex($key);
        /*
         * the list is requested from the array based on
         * the array index hash.
         */
        /** @var SinglyLinkedList $list */
        if (!isset($this->bucket[$arrayIndex])) {
            return null;
        }
        $list = $this->bucket[$arrayIndex];
        if (!$list->containsKey($key)) {
            return null;
        }
        $node = $list->getNodeByKey($key);
        return $node;
    }
public function getNodeByKey ( $ key ) : ? Node { $ arrayIndex = $ this -> getBucketIndex ( $ key ) ; /*
         * the list is requested from the array based on
         * the array index hash.
         */ /** @var SinglyLinkedList $list */ if ( ! isset ( $ this -> bucket [ $ arrayIndex ] ) ) { return null ; } $ list = $ this -> bucket [ $ arrayIndex ] ; if ( ! $ list -> containsKey ( $ key ) ) { return null ; } $ node = $ list -> getNodeByKey ( $ key ) ; return $ node ; }
searches the hash map for a node by a given key.

@param $key
@return Node|null
@throws \doganoo\PHPAlgorithms\common\Exception\InvalidKeyTypeException
@throws \doganoo\PHPAlgorithms\common\Exception\UnsupportedKeyTypeException
searches the hash map for a node by a given key .