| @@ 112-127 (lines=16) @@ | ||
| 109 | /** |
|
| 110 | * {@inheritdoc} |
|
| 111 | */ |
|
| 112 | public function intersect(SetInterface $set): SetInterface |
|
| 113 | { |
|
| 114 | $this->validate($set); |
|
| 115 | ||
| 116 | $newSet = clone $this; |
|
| 117 | $newSet->values = $this->values->intersect( |
|
| 118 | $set->reduce( |
|
| 119 | $this->values->clear(), |
|
| 120 | function(Stream $carry, $value): Stream { |
|
| 121 | return $carry->add($value); |
|
| 122 | } |
|
| 123 | ) |
|
| 124 | ); |
|
| 125 | ||
| 126 | return $newSet; |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * {@inheritdoc} |
|
| @@ 177-192 (lines=16) @@ | ||
| 174 | /** |
|
| 175 | * {@inheritdoc} |
|
| 176 | */ |
|
| 177 | public function diff(SetInterface $set): SetInterface |
|
| 178 | { |
|
| 179 | $this->validate($set); |
|
| 180 | ||
| 181 | $newSet = clone $this; |
|
| 182 | $newSet->values = $this->values->diff( |
|
| 183 | $set->reduce( |
|
| 184 | $this->values->clear(), |
|
| 185 | function(Stream $carry, $value): Stream { |
|
| 186 | return $carry->add($value); |
|
| 187 | } |
|
| 188 | ) |
|
| 189 | ); |
|
| 190 | ||
| 191 | return $newSet; |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * {@inheritdoc} |
|