| @@ 101-116 (lines=16) @@ | ||
| 98 | /** |
|
| 99 | * {@inheritdoc} |
|
| 100 | */ |
|
| 101 | public function intersect(SetInterface $set): SetInterface |
|
| 102 | { |
|
| 103 | $this->validate($set); |
|
| 104 | ||
| 105 | $newSet = clone $this; |
|
| 106 | $newSet->values = $this->values->intersect( |
|
| 107 | $set->reduce( |
|
| 108 | $this->values->clear(), |
|
| 109 | function(Stream $carry, $value): Stream { |
|
| 110 | return $carry->add($value); |
|
| 111 | } |
|
| 112 | ) |
|
| 113 | ); |
|
| 114 | ||
| 115 | return $newSet; |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * {@inheritdoc} |
|
| @@ 166-181 (lines=16) @@ | ||
| 163 | /** |
|
| 164 | * {@inheritdoc} |
|
| 165 | */ |
|
| 166 | public function diff(SetInterface $set): SetInterface |
|
| 167 | { |
|
| 168 | $this->validate($set); |
|
| 169 | ||
| 170 | $newSet = clone $this; |
|
| 171 | $newSet->values = $this->values->diff( |
|
| 172 | $set->reduce( |
|
| 173 | $this->values->clear(), |
|
| 174 | function(Stream $carry, $value): Stream { |
|
| 175 | return $carry->add($value); |
|
| 176 | } |
|
| 177 | ) |
|
| 178 | ); |
|
| 179 | ||
| 180 | return $newSet; |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * {@inheritdoc} |
|