src/Common/Abstracts/AbstractLinkedList.php
public function replaceValue($key, $value): bool {
        $replaced = false;
        $node = $this->getHead();
        while ($node !== null) {
            if (Comparator::equals($node->getKey(), $key)) {
                $node->setValue($value);
                $replaced = true;
            }
            $node = $node->getNext();
        }
        return $replaced;
    }
public function replaceValue($key, $value): bool {
        $replaced = false;
        $node = $this->getHead();
        while ($node !== null) {
            if (Comparator::equals($node->getKey(), $key)) {
                $node->setValue($value);
                $replaced = true;
            }
            $node = $node->getNext();
        }
        return $replaced;
    }
public function replaceValue ( $ key , $ value ) : bool { $ replaced = false ; $ node = $ this -> getHead ( ) ; while ( $ node !== null ) { if ( Comparator :: equals ( $ node -> getKey ( ) , $ key ) ) { $ node -> setValue ( $ value ) ; $ replaced = true ; } $ node = $ node -> getNext ( ) ; } return $ replaced ; }
replaces a value for a key

@param $key
@param $value
@return bool
replaces a value for a key