public static final function map(\Traversable $traversable, UnaryFunktionInterface $functor) : \Traversable { $result = new \ArrayIterator(); foreach ($traversable as $value) { $result->append($functor->apply($value)); } return $result; }
/** * * {@inheritdoc} * * @see \intrawarez\sabertooth\optionals\OptionalInterface::map() */ public function map(UnaryFunktionInterface $functor) : OptionalInterface { if ($this->isPresent()) { return self::of($functor->apply($this->get())); } return self::absent(); }