1 | <?php |
||
11 | class ArrayList extends AbstractList { |
||
12 | |||
13 | /** |
||
14 | * Creates a new ArrayList |
||
15 | * |
||
16 | * @param array|Iterator $collection |
||
17 | */ |
||
18 | public function __construct($collection = []) { |
||
21 | |||
22 | /** |
||
23 | * Adds an element to that list |
||
24 | * |
||
25 | * @param mixed $element |
||
26 | * @param int $index |
||
27 | * @return $this |
||
28 | */ |
||
29 | public function add($element, $index = null) { |
||
38 | |||
39 | /** |
||
40 | * Adds all elements to the list |
||
41 | * |
||
42 | * @param array|Iterator $collection |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function addAll($collection) { |
||
52 | |||
53 | /** |
||
54 | * Returns the element at the given index (or nothing if the index isn't present) |
||
55 | * |
||
56 | * @param int $index |
||
57 | * @return mixed |
||
58 | */ |
||
59 | public function get($index) { |
||
64 | |||
65 | /** |
||
66 | * Returns the index of the given element or FALSE if the element can't be found |
||
67 | * |
||
68 | * @param mixed $element |
||
69 | * @return int the index for the given element |
||
70 | */ |
||
71 | public function indexOf($element) { |
||
74 | |||
75 | /** |
||
76 | * Removes an element from the list |
||
77 | * |
||
78 | * @param mixed $element |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function remove($element) { |
||
89 | |||
90 | /** |
||
91 | * Removes all elements from the list |
||
92 | * |
||
93 | * @param array|Iterator $collection |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function removeAll($collection) { |
||
103 | |||
104 | } |
||
105 |