src/Common/Abstracts/AbstractLinkedList.php
public function getNodeByValue($value): ?Node {
        if (!$this->containsValue($value)) {
            return null;
        }
        $tmp = $this->getHead();
        while ($tmp !== null) {
            $val = $tmp->getValue();
            if (Comparator::equals($val, $value)) {
                //if the value is found then return it
                return $tmp;
            }
            $tmp = $tmp->getNext();
        }
        return null;
    }
public function getNodeByValue($value): ?Node {
        if (!$this->containsValue($value)) {
            return null;
        }
        $tmp = $this->getHead();
        while ($tmp !== null) {
            $val = $tmp->getValue();
            if (Comparator::equals($val, $value)) {
                //if the value is found then return it
                return $tmp;
            }
            $tmp = $tmp->getNext();
        }
        return null;
    }
public function getNodeByValue ( $ value ) : ? Node { if ( ! $ this -> containsValue ( $ value ) ) { return null ; } $ tmp = $ this -> getHead ( ) ; while ( $ tmp !== null ) { $ val = $ tmp -> getValue ( ) ; if ( Comparator :: equals ( $ val , $ value ) ) { //if the value is found then return it return $ tmp ; } $ tmp = $ tmp -> getNext ( ) ; } return null ; }
searches the list for a node by a given key

@param $value
@return \doganoo\PHPAlgorithms\Datastructure\Lists\Node|null
searches the list for a node by a given key