MutableSet
Represents a write-enabled (mutable) set of values, not indexed by keys (i.e. a set)
Guides
Interface Synopsis
interface MutableSet implements ConstSet<Tv>, HH\Collection<Tv>, SetAccess<Tv> {...}
Public Methods
->concat<Tu super Tv>(Traversable<Tu> $traversable): MutableVector<Tu>
Returns aMutableVector
that is the concatenation of the values of the currentMutableSet
and the values of the providedTraversable
->filter((function(Tv): bool) $fn): MutableSet<Tv>
Returns aMutableSet
containing the values of the currentMutableSet
that meet a supplied condition applied to each value->filterWithKey((function(arraykey, Tv): bool) $fn): MutableSet<Tv>
Returns aMutableSet
containing the values of the currentMutableSet
that meet a supplied condition applied to its "keys" and values->firstKey(): ?arraykey
Returns the first "key" in the currentMutableSet
->firstValue(): ?Tv
Returns the first value in the currentMutableSet
->keys(): MutableVector<arraykey>
Returns aMutableVector
containing the values of the currentMutableSet
->lastKey(): ?arraykey
Returns the last "key" in the currentMutableSet
->lastValue(): ?Tv
Returns the last value in the currentMutableSet
->map<Tu as arraykey>((function(Tv): Tu) $fn): MutableSet<Tu>
Returns aMutableSet
containing the values after an operation has been applied to each value in the currentMutableSet
->mapWithKey<Tu as arraykey>((function(arraykey, Tv): Tu) $fn): MutableSet<Tu>
Returns aMutableSet
containing the values after an operation has been applied to each "key" and value in the current Set->skip(int $n): MutableSet<Tv>
Returns aMutableSet
containing the values after then
-th element of the currentMutableSet
->skipWhile((function(Tv): bool) $fn): MutableSet<Tv>
Returns aMutableSet
containing the values of the currentMutableSet
starting after and including the first value that producestrue
when passed to the specified callback->slice(int $start, int $len): MutableSet<Tv>
Returns a subset of the currentMutableSet
starting from a given key up to, but not including, the element at the provided length from the starting key->take(int $n): MutableSet<Tv>
Returns aMutableSet
containing the firstn
values of the currentMutableSet
->takeWhile((function(Tv): bool) $fn): MutableSet<Tv>
Returns aMutableSet
containing the values of the currentMutableSet
up to but not including the first value that producesfalse
when passed to the specified callback->toDArray(): darray<Tv, Tv>
->toVArray(): varray<Tv>
->values(): MutableVector<Tv>
Returns aMutableVector
containing the values of the currentMutableSet
->zip<Tu>(Traversable<Tu> $traversable): MutableSet<nothing>
Returns aMutableSet
where each value is aPair
that combines the value of the currentMutableSet
and 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 (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 anarray
with 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 anarray
with 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