/** * Look at the value stored in the last item without removing from the list. */ public function peakBack() { if ($this->is_empty()) { return NULL; } else { return $this->last->getData(); } }
/** * Constructor * @param mixed $data * @param Staple_Data_LinkedListNodeDouble $next * @param Staple_Data_LinkedListNodeDouble $prev */ public function __construct($data, Staple_Data_LinkedListNodeDouble $next = NULL, Staple_Data_LinkedListNodeDouble $prev = NULL) { //Call the parent constructor parent::__construct($data, $next); //Set the previous node pointer if (isset($prev)) { $this->setPrev($prev); } }