public function get($key) {

        if (!isset($this->hashmap[$key])) { return null; }

        $node = $this->hashmap[$key];
        if (count($this->hashmap) == 1) { return $node->getData(); }

        // refresh the access
        $this->detach($node);
        $this->attach($this->head, $node);

        return $node->getData();
    }
public function get($key) {

        if (!isset($this->hashmap[$key])) { return null; }

        $node = $this->hashmap[$key];
        if (count($this->hashmap) == 1) { return $node->getData(); }

        // refresh the access
        $this->detach($node);
        $this->attach($this->head, $node);

        return $node->getData();
    }
public function get ( $ key ) { if ( ! isset ( $ this -> hashmap [ $ key ] ) ) { return null ; } $ node = $ this -> hashmap [ $ key ] ; if ( count ( $ this -> hashmap ) == 1 ) { return $ node -> getData ( ) ; } // refresh the access $ this -> detach ( $ node ) ; $ this -> attach ( $ this -> head , $ node ) ; return $ node -> getData ( ) ; }
Get an element with the given key
@param string $key the key of the element to be retrieved
@return mixed the content of the element to be retrieved
Get an element with the given key