| @@ 189-207 (lines=19) @@ | ||
| 186 | /** |
|
| 187 | * {@inheritDoc} |
|
| 188 | */ |
|
| 189 | public function lastIndexOf($data) { |
|
| 190 | if($this->head === null) { |
|
| 191 | return false; |
|
| 192 | } |
|
| 193 | ||
| 194 | $current = $this->head; |
|
| 195 | $i = 0; |
|
| 196 | $pos = false; |
|
| 197 | while($i < $this->size) { |
|
| 198 | if($current->data === $data) { |
|
| 199 | $pos = $i; |
|
| 200 | } |
|
| 201 | ||
| 202 | $current = $current->next; |
|
| 203 | $i++; |
|
| 204 | } |
|
| 205 | ||
| 206 | return $pos; |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * {@inheritDoc} |
|
| @@ 139-157 (lines=19) @@ | ||
| 136 | /** |
|
| 137 | * {@inheritDoc} |
|
| 138 | */ |
|
| 139 | public function lastIndexOf($data) { |
|
| 140 | if($this->head === null) { |
|
| 141 | return false; |
|
| 142 | } |
|
| 143 | ||
| 144 | $current = $this->head; |
|
| 145 | $i = 0; |
|
| 146 | $pos = false; |
|
| 147 | while($i < $this->size) { |
|
| 148 | if($current->data == $data) { |
|
| 149 | $pos = $i; |
|
| 150 | } |
|
| 151 | ||
| 152 | $current = $current->next; |
|
| 153 | $i++; |
|
| 154 | } |
|
| 155 | ||
| 156 | return $pos; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * {@inheritDoc} |
|
| @@ 135-153 (lines=19) @@ | ||
| 132 | /** |
|
| 133 | * {@inheritDoc} |
|
| 134 | */ |
|
| 135 | public function lastIndexOf($data) { |
|
| 136 | if($this->head === null) { |
|
| 137 | return false; |
|
| 138 | } |
|
| 139 | ||
| 140 | $current = $this->head; |
|
| 141 | $i = 0; |
|
| 142 | $pos = false; |
|
| 143 | while($i < $this->size) { |
|
| 144 | if($current->data == $data) { |
|
| 145 | $pos = $i; |
|
| 146 | } |
|
| 147 | ||
| 148 | $current = $current->next; |
|
| 149 | $i++; |
|
| 150 | } |
|
| 151 | ||
| 152 | return $pos; |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * {@inheritDoc} |
|