MutableMap
Represents a write-enabled (mutable) sequence of key/value pairs (i.e. a map)
Guides
Interface Synopsis
interface MutableMap implements ConstMap<Tk, Tv>, HH\Collection<Pair<Tk, Tv>>, MapAccess<Tk, Tv> {...}
Public Methods
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>
Returns aMutableVectorthat is the concatenation of the values of the currentMutableMapand the values of the providedTraversable->filter((function(Tv): bool) $fn): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the values of the currentMutableMapthat meet a supplied condition->filterWithKey((function(Tk, Tv): bool) $fn): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the values of the currentMutableMapthat meet a supplied condition applied to its keys and values->firstKey(): ?Tk
Returns the first key in the currentMutableMap->firstValue(): ?Tv
Returns the first value in the currentMutableMap->keys(): MutableVector<Tk>
Returns aMutableVectorcontaining the keys of the currentMutableMap->lastKey(): ?Tk
Returns the last key in the currentMutableMap->lastValue(): ?Tv
Returns the last value in the currentMutableMap->map<Tu>((function(Tv): Tu) $fn): MutableMap<Tk, Tu>
Returns aMutableMapafter an operation has been applied to each value in the currentMutableMap->mapWithKey<Tu>((function(Tk, Tv): Tu) $fn): MutableMap<Tk, Tu>
Returns aMutableMapafter an operation has been applied to each key and value in the currentMutableMap->skip(int $n): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the values after then-th element of the currentMutableMap->skipWhile((function(Tv): bool) $fn): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the values of the currentMutableMapstarting after and including the first value that producestruewhen passed to the specified callback->slice(int $start, int $len): MutableMap<Tk, Tv>
Returns a subset of the currentMutableMapstarting from a given key location up to, but not including, the element at the provided length from the starting key location->take(int $n): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the firstnkey/values of the currentMutableMap->takeWhile((function(Tv): bool) $fn): MutableMap<Tk, Tv>
Returns aMutableMapcontaining the keys and values of the currentMutableMapup to but not including the first value that producesfalsewhen passed to the specified callback->toDArray(): darray<Tk, Tv>->toVArray(): varray<Tv>->values(): MutableVector<Tv>
Returns aMutableVectorcontaining the values of the currentMutableMap->zip<Tu>(Traversable<Tu> $traversable): MutableMap<Tk, Pair<Tv, Tu>>
Returns aMutableMapwhere each value is aPairthat combines the value of the currentMutableMapand the providedTraversable
Public Methods (ConstCollection)
-
->count(): int
Get the number of items in the collection -
->isEmpty(): bool
Is the collection empty? -
->items(): HH\Iterable<Te>
Get access to the items in the collection
Public Methods (IPureStringishObject)
Public Methods (ConstSetAccess)
->contains(arraykey $m): bool
Checks whether a value is in the currentSet
Public Methods (ConstIndexAccess)
->at(Tk $k): Tv
Returns the value at the specified key in the current collection->containsKey(mixed $k): bool
Determines if the specified key is in the current collection->get(Tk $k): ?Tv
Returns the value at the specified key in the current collection
Public Methods (HH\KeyedIterable)
->getIterator(): KeyedIterator<Tk, Tv>
Returns an iterator that points to beginning of the currentKeyedIterable->lazy(): KeyedIterable<Tk, Tv>
Returns a lazy, access elements only when needed view of the currentKeyedIterable->toImmMap(): ImmMap<Tk, Tv>
Returns an immutable map (ImmMap) based on the keys and values of the currentKeyedIterable->toKeysArray(): varray
Returns anarraywith the keys from the currentKeyedIterable
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 anarraywith the values from the currentIterable
Public Methods (HH\Collection)
->clear()
Removes all items from the collection
Public Methods (OutputCollection)
->add(Te $e): this
Add a value to the collection and return the collection itself->addAll(?Traversable<Te> $traversable): this
For every element in the providedTraversable, append a value into the current collection
Public Methods (SetAccess)
->remove(Tm $m): this
Removes the provided value from the currentSet
Public Methods (IndexAccess)
->removeKey(Tk $k): this
Removes the specified key (and associated value) from the current collection->set(Tk $k, Tv $v): this
Stores a value into the current collection with the specified key, overwriting the previous value associated with the key->setAll(?KeyedTraversable<Tk, Tv> $traversable): this
For every element in the providedTraversable, stores a value into the current collection associated with each key, overwriting the previous value associated with the key