@@ 66-74 (lines=9) @@ | ||
63 | * @param CollectionInterface $collection |
|
64 | * @return bool |
|
65 | */ |
|
66 | public function addAll(CollectionInterface $collection): bool |
|
67 | { |
|
68 | $size = $this->count(); |
|
69 | foreach ($collection as $element) { |
|
70 | $this->add($element); |
|
71 | } |
|
72 | ||
73 | return $size !== $this->count(); |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * Removes all elements from a collection |
@@ 91-101 (lines=11) @@ | ||
88 | * @param CollectionInterface $collection |
|
89 | * @return bool |
|
90 | */ |
|
91 | public function retainAll(CollectionInterface $collection): bool |
|
92 | { |
|
93 | $size = $this->count(); |
|
94 | foreach ($this as $element) { |
|
95 | if (!$collection->contains($element)) { |
|
96 | $this->remove($element); |
|
97 | } |
|
98 | } |
|
99 | ||
100 | return $size !== $this->count(); |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * Find the first element in collection |