The Sequence interfaceIntroductionA Sequence describes the behaviour of values arranged in a single, linear dimension. Some languages refer to this as a "List". It’s similar to an array that uses incremental integer keys, with the exception of a few characteristics:
Use cases:
Interface synopsis
Ds\Sequence
extends
Ds\Collection
ArrayAccess
/* Methods */
abstract public void Ds\Sequence::allocate(int
$capacity )abstract public void Ds\Sequence::apply(callable
$callback )abstract public int Ds\Sequence::capacity()
abstract public bool Ds\Sequence::contains(mixed
...$values )abstract public Ds\Sequence Ds\Sequence::filter(callable
$callback = ?)abstract public mixed Ds\Sequence::find(mixed
$value )abstract public mixed Ds\Sequence::first()
abstract public mixed Ds\Sequence::get(int
$index )abstract public void Ds\Sequence::insert(int
$index , mixed ...$values )abstract public string Ds\Sequence::join(string
$glue = ?)abstract public mixed Ds\Sequence::last()
abstract public Ds\Sequence Ds\Sequence::map(callable
$callback )abstract public Ds\Sequence Ds\Sequence::merge(mixed
$values )abstract public mixed Ds\Sequence::pop()
abstract public void Ds\Sequence::push(mixed
...$values )abstract public mixed Ds\Sequence::reduce(callable
$callback , mixed $initial = ?)abstract public mixed Ds\Sequence::remove(int
$index )abstract public void Ds\Sequence::reverse()
abstract public Ds\Sequence Ds\Sequence::reversed()
abstract public void Ds\Sequence::rotate(int
$rotations )abstract public void Ds\Sequence::set(int
$index , mixed $value )abstract public mixed Ds\Sequence::shift()
abstract public Ds\Sequence Ds\Sequence::slice(int
$index , int $length = ?)abstract public void Ds\Sequence::sort(callable
$comparator = ?)abstract public Ds\Sequence Ds\Sequence::sorted(callable
$comparator = ?)abstract public intfloat Ds\Sequence::sum()
abstract public void Ds\Sequence::unshift(mixed
$values = ?)/* Inherited methods */
public void Ds\Collection::clear()
public Ds\Collection Ds\Collection::copy()
public bool Ds\Collection::isEmpty()
public array Ds\Collection::toArray()
public int Countable::count()
public Traversable IteratorAggregate::getIterator()
public mixed JsonSerializable::jsonSerialize()
public bool ArrayAccess::offsetExists(mixed
$offset )public mixed ArrayAccess::offsetGet(mixed
$offset )public void ArrayAccess::offsetSet(mixed
$offset , mixed $value )public void ArrayAccess::offsetUnset(mixed
$offset )Changelog
|