HH\Collection
Collection
is the primary collection interface for mutable collections
Assuming you want the ability to clear out your collection, you would
implement this (or a child of this) interface. Otherwise, you can implement
OutputCollection
only. If your collection to be immutable, implement
ConstCollection
only instead.
Guides
Interface Synopsis
namespace HH;
interface Collection implements \ConstCollection<Te>, \OutputCollection<Te> {...}
Public Methods
->clear()
Removes all items from the collection
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 (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