HH\KeyedIterable
Represents any entity that can be iterated over using something like
foreach
The entity is required to have a key in addition to values.
KeyedIterable
does not include array
s.
Guides
Interface Synopsis
namespace HH;
interface KeyedIterable implements Iterable<Tv>, KeyedTraversable<Tk, Tv> {...}
Public Methods
->concat<Tu super Tv>(Traversable<Tu> $traversable): Iterable<Tu>
Returns anIterable
that is the concatenation of the values of the currentKeyedIterable
and the values of the providedTraversable
->filter((function(Tv): bool) $fn): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the values of the currentKeyedIterable
that meet a supplied condition->filterWithKey((function(Tk, Tv): bool) $callback): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the values of the currentKeyedIterable
that meet a supplied condition applied to its keys and values->firstKey(): ?Tk
Returns the first key in the currentKeyedIterable
->firstValue(): ?Tv
Returns the first value in the currentKeyedIterable
->getIterator(): KeyedIterator<Tk, Tv>
Returns an iterator that points to beginning of the currentKeyedIterable
->keys(): Iterable<Tk>
Returns anIterable
containing the currentKeyedIterable
's keys->lastKey(): ?Tk
Returns the last key in the currentKeyedIterable
->lastValue(): ?Tv
Returns the last value in the currentKeyedIterable
->lazy(): KeyedIterable<Tk, Tv>
Returns a lazy, access elements only when needed view of the currentKeyedIterable
->map<Tu>((function(Tv): Tu) $fn): KeyedIterable<Tk, Tu>
Returns aKeyedIterable
containing the values after an operation has been applied to each value in the currentKeyedIterable
->mapWithKey<Tu>((function(Tk, Tv): Tu) $callback): KeyedIterable<Tk, Tu>
Returns aKeyedIterable
containing the values after an operation has been applied to each key and value in the currentKeyedIterable
->skip(int $n): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the values after then
-th element of the currentKeyedIterable
->skipWhile((function(Tv): bool) $fn): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the values of the currentKeyedIterable
starting after and including the first value that producestrue
when passed to the specified callback->slice(int $start, int $len): KeyedIterable<Tk, Tv>
Returns a subset of the currentKeyedIterable
starting from a given key up to, but not including, the element at the provided length from the starting key->take(int $n): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the firstn
values of the currentKeyedIterable
->takeWhile((function(Tv): bool) $fn): KeyedIterable<Tk, Tv>
Returns aKeyedIterable
containing the values of the currentKeyedIterable
up to but not including the first value that producesfalse
when passed to the specified callback->toImmMap(): ImmMap<Tk, Tv>
Returns an immutable map (ImmMap
) based on the keys and values of the currentKeyedIterable
->toKeysArray(): varray
Returns anarray
with the keys from the currentKeyedIterable
->values(): Iterable<Tv>
Returns anIterable
containing the currentKeyedIterable
's values->zip<Tu>(Traversable<Tu> $traversable): KeyedIterable<Tk, Pair<Tv, Tu>>
Returns aKeyedIterable
where each element is aPair
that combines the element of the currentKeyedIterable
and the providedTraversable
Public Methods (HH\Iterable
)
->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