collections: add Set::retain
Summary: The same as Set::filter, but instead of creating a new result Set to
hold the values that pass the given predicate function, instead
mutate the original set and remove values that don't pass the
predicate.
This is useful for code that wants to destructively update the Set without
intermediate unnecessary allocations, since we invalidate iterators for
`foreach ($s as $i) { ... $s->remove($i); ... }`.
Reviewed By: andrewparoski
Subscribers: jdelong, julienv, hphp-diffslists, ps, joelm
Differential Revision:
D1328836