MutableVector
Represents a write-enabled (mutable) sequence of values, indexed by integers (i.e., a vector)
Guides
Interface Synopsis
interface MutableVector implements ConstVector<Tv>, HH\Collection<Tv>, IndexAccess<int, Tv> {...}
Public Methods
- ->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>
 Returns a- MutableVectorthat is the concatenation of the values of the current- MutableVectorand the values of the provided- Traversable
- ->filter((function(Tv): bool) $fn): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values of the current- MutableVectorthat meet a supplied condition
- ->filterWithKey((function(int, Tv): bool) $fn): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values of the current- MutableVectorthat meet a supplied condition applied to its keys and values
- ->firstKey(): ?int
 Returns the first key in the current- MutableVector
- ->firstValue(): ?Tv
 Returns the first value in the current- MutableVector
- ->keys(): MutableVector<int>
 Returns a- MutableVectorcontaining the keys of the current- MutableVector
- ->lastKey(): ?int
 Returns the last key in the current- MutableVector
- ->lastValue(): ?Tv
 Returns the last value in the current- MutableVector
- ->linearSearch(mixed $search_value): int
 Returns the index of the first element that matches the search value
- ->map<Tu>((function(Tv): Tu) $fn): MutableVector<Tu>
 Returns a- MutableVectorcontaining the values after an operation has been applied to each value in the current- MutableVector
- ->mapWithKey<Tu>((function(int, Tv): Tu) $fn): MutableVector<Tu>
 Returns a- MutableVectorcontaining the values after an operation has been applied to each key and value in the current- MutableVector
- ->skip(int $n): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values after the- n-th element of the current- MutableVector
- ->skipWhile((function(Tv): bool) $fn): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values of the current- MutableVectorstarting after and including the first value that produces- truewhen passed to the specified callback
- ->slice(int $start, int $len): MutableVector<Tv>
 Returns a subset of the current- MutableVectorstarting from a given key up to, but not including, the element at the provided length from the starting key
- ->take(int $n): MutableVector<Tv>
 Returns a- MutableVectorcontaining the first- nvalues of the current- MutableVector
- ->takeWhile((function(Tv): bool) $fn): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values of the current- MutableVectorup to but not including the first value that produces- falsewhen passed to the specified callback
- ->toDArray(): darray<int, Tv>
- ->toVArray(): varray<Tv>
- ->values(): MutableVector<Tv>
 Returns a- MutableVectorcontaining the values of the current- MutableVector
- ->zip<Tu>(Traversable<Tu> $traversable): MutableVector<Pair<Tv, Tu>>
 Returns a- MutableVectorwhere each element is a- Pairthat combines the element of the current- MutableVectorand the provided- Traversable
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 (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 current- KeyedIterable
- ->lazy(): KeyedIterable<Tk, Tv>
 Returns a lazy, access elements only when needed view of the current- KeyedIterable
- ->toImmMap(): ImmMap<Tk, Tv>
 Returns an immutable map (- ImmMap) based on the keys and values of the current- KeyedIterable
- ->toKeysArray(): varray
 Returns an- arraywith the keys from the current- KeyedIterable
Public Methods (HH\Iterable)
- ->toImmSet(): ImmSet<Tv>
 Returns an immutable set (- ImmSet) converted from the current- Iterable
- ->toImmVector(): ImmVector<Tv>
 Returns an immutable vector (- ImmVector) converted from the current- Iterable
- ->toValuesArray(): varray<Tv>
 Returns an- arraywith the values from the current- Iterable
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 provided- Traversable, append a value into the current collection
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 provided- Traversable, stores a value into the current collection associated with each key, overwriting the previous value associated with the key