| @@ 62-73 (lines=12) @@ | ||
| 59 | * @return multitype |
|
| 60 | * @throws NoSuchElementException |
|
| 61 | */ |
|
| 62 | public function next() |
|
| 63 | { |
|
| 64 | if($this->hasNext()) |
|
| 65 | { |
|
| 66 | $this->canRemove = true; |
|
| 67 | return $this->list->get(++$this->index); |
|
| 68 | } |
|
| 69 | else |
|
| 70 | { |
|
| 71 | throw new NoSuchElementException("Could not find element at index {$this->index}"); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Removes from the list the last element that was returned by next() |
|
| @@ 47-58 (lines=12) @@ | ||
| 44 | * Returns true if this list iterator has more elements when traversing the list in the backward direction. |
|
| 45 | * @return boolean |
|
| 46 | */ |
|
| 47 | public function next() |
|
| 48 | { |
|
| 49 | if ($this->hasNext()) |
|
| 50 | { |
|
| 51 | $this->canRemove = true; |
|
| 52 | return $this->list->get(--$this->index); |
|
| 53 | } |
|
| 54 | else |
|
| 55 | { |
|
| 56 | throw new NoSuchElementException("Could not find element at index {$this->index}"); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Returns the next element in the list and advances the cursor position. |
|
| @@ 55-66 (lines=12) @@ | ||
| 52 | * Returns the next element in the iteration. |
|
| 53 | * @return multitype |
|
| 54 | */ |
|
| 55 | public function next() |
|
| 56 | { |
|
| 57 | if($this->hasNext()) |
|
| 58 | { |
|
| 59 | $this->canRemove = true; |
|
| 60 | return $this->array[++$this->index]; |
|
| 61 | } |
|
| 62 | else |
|
| 63 | { |
|
| 64 | throw new NoSuchElementException(); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Returns true if the iteration has more elements. (In other words, returns |
|