HH\Iterable
Represents any entity that can be iterated over using something like
foreach
The entity does not necessarily have to have a key, just values.
Iterable
does not include array
s.
Guides
Interface Synopsis
namespace HH;
interface Iterable implements Traversable<Tv>, \IteratorAggregate<Tv> {...}
Public Methods
->concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>
Returns anIterable
that is the concatenation of the values of the currentIterable
and the values of the providedTraversable
->filter((function(Tv): bool) $fn): Iterable<Tv>
Returns anIterable
containing the values of the currentIterable
that meet a supplied condition->firstValue(): ?Tv
Returns the first value in the currentIterable
->getIterator(): Iterator<Tv>
Returns an iterator that points to beginning of the currentIterable
->lastValue(): ?Tv
Returns the last value in the currentIterable
->lazy(): Iterable<Tv>
Returns a lazy, access elements only when needed view of the currentIterable
->map<Tu>((function(Tv): Tu) $fn): Iterable<Tu>
Returns anIterable
containing the values after an operation has been applied to each value in the currentIterable
->skip(int $n): Iterable<Tv>
Returns anIterable
containing the values after then
-th element of the currentIterable
->skipWhile((function(Tv): bool) $fn): Iterable<Tv>
Returns anIterable
containing the values of the currentIterable
starting after and including the first value that producestrue
when passed to the specified callback->slice(int $start, int $len): Iterable<Tv>
Returns a subset of the currentIterable
starting from a given key up to, but not including, the element at the provided length from the starting key->take(int $n): Iterable<Tv>
Returns anIterable
containing the firstn
values of the currentIterable
->takeWhile((function(Tv): bool) $fn): Iterable<Tv>
Returns anIterable
containing the values of the currentIterable
up to but not including the first value that producesfalse
when passed to the specified callback->toImmSet(): ImmSet<Tv>
Returns an immutable set (ImmSet
) converted from the currentIterable
->toImmVector(): ImmVector<Tv>
Returns an immutable vector (ImmVector
) converted from the currentIterable
->toValuesArray(): varray<Tv>
Returns anarray
with the values from the currentIterable
->values(): Iterable<Tv>
Returns anIterable
containing the currentIterable
's values->zip<Tu>(Traversable<Tu> $traversable): Iterable<Pair<Tv, Tu>>
Returns anIterable
where each element is aPair
that combines the element of the currentIterable
and the providedTraversable