1 | <?php |
||
13 | class Queue extends AbstractList { |
||
14 | |||
15 | /** |
||
16 | * Creates a new Queue |
||
17 | * |
||
18 | * @param array|Iterator $collection |
||
19 | */ |
||
20 | public function __construct($collection = []) { |
||
25 | |||
26 | /** |
||
27 | * Enqueues an element |
||
28 | * |
||
29 | * @param mixed $element |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function enqueue($element) { |
||
37 | |||
38 | /** |
||
39 | * Enqueues many elements |
||
40 | * |
||
41 | * @param array|Iterator $collection |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function enqueueAll($collection) { |
||
51 | |||
52 | /** |
||
53 | * Returns the element at the head or null if the queue is empty but doesn't remove that element |
||
54 | * |
||
55 | * @return mixed |
||
56 | */ |
||
57 | public function peek() { |
||
64 | |||
65 | /** |
||
66 | * Removes and returns the element at the head or null if the is empty |
||
67 | * |
||
68 | * @return mixed |
||
69 | */ |
||
70 | public function poll() { |
||
73 | |||
74 | } |