| @@ 230-257 (lines=28) @@ | ||
| 227 | /** |
|
| 228 | * |
|
| 229 | */ |
|
| 230 | public function indexOf($data) { |
|
| 231 | if($this->head === null) { |
|
| 232 | return false; |
|
| 233 | } |
|
| 234 | ||
| 235 | $current = $this->head; |
|
| 236 | $i = 0; |
|
| 237 | ||
| 238 | while($i < $this->size) { |
|
| 239 | if($current->data == $data) { |
|
| 240 | return $i; |
|
| 241 | } |
|
| 242 | ||
| 243 | $current = $current->next; |
|
| 244 | $i++; |
|
| 245 | } |
|
| 246 | ||
| 247 | return false; |
|
| 248 | } |
|
| 249 | ||
| 250 | /** |
|
| 251 | * |
|
| 252 | */ |
|
| 253 | public function lastIndexOf($data) { |
|
| 254 | if($this->head === null) { |
|
| 255 | return false; |
|
| 256 | } |
|
| 257 | ||
| 258 | $current = $this->head; |
|
| 259 | $i = 0; |
|
| 260 | $pos = false; |
|
| @@ 154-172 (lines=19) @@ | ||
| 151 | /** |
|
| 152 | * |
|
| 153 | */ |
|
| 154 | public function indexOf($data) { |
|
| 155 | if($this->head === null) { |
|
| 156 | return false; |
|
| 157 | } |
|
| 158 | ||
| 159 | $current = $this->head; |
|
| 160 | $i = 0; |
|
| 161 | ||
| 162 | while($i < $this->size) { |
|
| 163 | if($current->data == $data) { |
|
| 164 | return $i; |
|
| 165 | } |
|
| 166 | ||
| 167 | $current = $current->next; |
|
| 168 | $i++; |
|
| 169 | } |
|
| 170 | ||
| 171 | return false; |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * |
|
| @@ 140-158 (lines=19) @@ | ||
| 137 | /** |
|
| 138 | * |
|
| 139 | */ |
|
| 140 | public function indexOf($data) { |
|
| 141 | if($this->head === null) { |
|
| 142 | return false; |
|
| 143 | } |
|
| 144 | ||
| 145 | $current = $this->head; |
|
| 146 | $i = 0; |
|
| 147 | ||
| 148 | while($i < $this->size) { |
|
| 149 | if($current->data == $data) { |
|
| 150 | return $i; |
|
| 151 | } |
|
| 152 | ||
| 153 | $current = $current->next; |
|
| 154 | $i++; |
|
| 155 | } |
|
| 156 | ||
| 157 | return false; |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * |
|