public function removeIf(PredicateInterface $predicate) : bool { $changed = false; foreach ($this as $x) { if ($predicate->test($x) && $this->remove($x) && !$changed) { $changed = true; } } return $changed; }
public static final function filter(\Traversable $traversable, PredicateInterface $predicate) : \Traversable { $result = new \ArrayIterator(); foreach ($traversable as $value) { if ($predicate->test($value)) { $result->append($value); } } return $result; }
public static final function none(array $array, PredicateInterface $predicate) : bool { return self::all($array, $predicate->not()); }