1 | <?php |
||
13 | class Stack extends AbstractList { |
||
14 | |||
15 | /** |
||
16 | * Creates a new ArrayList |
||
17 | * |
||
18 | * @param array|Iterator $collection |
||
19 | */ |
||
20 | public function __construct($collection = []) { |
||
23 | |||
24 | /** |
||
25 | * Pushes an element onto the stack |
||
26 | * |
||
27 | * @param mixed $element |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function push($element) { |
||
35 | |||
36 | /** |
||
37 | * Pushes many elements onto the stack |
||
38 | * |
||
39 | * @param array|Iterator $collection |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function pushAll($collection) { |
||
49 | |||
50 | /** |
||
51 | * Returns the element at the head or null if the stack is empty but doesn't remove that element |
||
52 | * |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function peek() { |
||
62 | |||
63 | /** |
||
64 | * Pops the element at the head from the stack or null if the stack is empty |
||
65 | * |
||
66 | * @return mixed |
||
67 | */ |
||
68 | public function pop() { |
||
71 | |||
72 | } |