public function containsAll(ZendX_Util_Collection_Interface $c) { $e = $c->iterator(); while ($e->hasNext()) { if (!$this->contains($e->next())) { return false; } } return true; }
public function insertAll($index, ZendX_Util_Collection_Interface $c) { $modified = false; $e = $c->iterator(); while ($e->hasNext()) { $this->insert($index++, $e->next()); $modified = true; } return $modified; }
public function insertAll($index, ZendX_Util_Collection_Interface $c) { try { $modified = false; $e1 = $this->listIterator($index); $e2 = $c->iterator(); while ($e2->hasNext()) { $e1->add($e2->next()); $modified = true; } return $modified; // TODO: implement custom exceptions when I can be bothered } catch (Zend_Exception $ex) { if ($e->getMessage() == 'NoSuchElement') { throw new Zend_Exception('IndexOutOfBounds'); } else { throw $ex; } } }
public function retainAll(ZendX_Util_Collection_Interface $collection) { $newStore = array(); $iterator = $collection->iterator(); while ($iterator->hasNext()) { $item = $iterator->next(); if ($this->contains($item)) { $newStore[] = $item; } } $this->store = $newStore; }