A Sequence can describe the behavior of values arranged in a single, linear dimension. Some languages can refer to this as a List. It is similar to an array that uses incremental integer keys, with the exception of a few characteristics.
Use cases
Ds\Sequence implements Ds\Collection { /* Methods */ abstract public void allocate( int $capacity ) abstract public void apply( callable $callback ) abstract public int capacity( void ) abstract public bool contains([ mixed $...values ] ) abstract public Ds\Sequence filter([ callable $callback ] ) abstract public mixed find( mixed $value ) abstract public mixed first( void ) abstract public mixed get( int $index ) abstract public void insert( int $index [, mixed $...values ] ) abstract public string join([ string $glue ] ) abstract public mixed last( void ) abstract public Ds\Sequence map( callable $callback ) abstract public Ds\Sequence merge( mixed $values ) abstract public mixed pop( void ) abstract public void push([ mixed $...values ] ) abstract public mixed reduce( callable $callback [, mixed $initial ] ) abstract public mixed remove( int $index ) abstract public void reverse( void ) abstract public Ds\Sequence reversed( void ) abstract public void rotate( int $rotations ) abstract public void set( int $index , mixed $value ) abstract public mixed shift( void ) abstract public Ds\Sequence slice( int $index [, int $length ] ) abstract public void sort([ callable $comparator ] ) abstract public Ds\Sequence sorted([ callable $comparator ] ) abstract public number sum( void ) abstract public void unshift([ mixed $values ] ) }
Ds\Map::MIN_CAPACITY
Sr.No | Function & Description |
---|---|
1 |
This Function can allocate enough memory for a required capacity. |
2 |
This Function can update all values by applying a callback function to each value. |
3 |
This Function can return the current capacity. |
4 |
This Function can determine if a sequence contains given values. |
5 |
create a new sequence using callable to determine which values to include. |
6 |
This Function can attempt to find the value's index. |
7 |
This Function can can return the first value in a sequence.. |
8 |
This Function can return the value at a given index. |
9 |
This Function can insert values at a given index. |
10 |
This Function can join all values together as a string. |
11 |
This Function can return the last value. |
12 |
This Function can return the result of applying a callback to each value. |
13 |
This Function can return the result of adding all given values to the sequence. |
14 |
This Function can remove and return the last value. |
15 |
This Function can add values to the end of a sequence. |
16 |
This Function can reduce the sequence to a single value using a callback function. |
17 |
This Function can remove and return a value by index. |
18 |
This Function can can reverse a sequence in-place. |
19 |
This Function can return a reversed copy. |
20 |
This Function can rotate the sequence by given number of rotations. |
21 |
This Function can update a value at the given index. |
22 |
This Function can remove and return a first value. |
23 |
This Function can return a sub-sequence of the given range. |
24 |
This Function can sort a sequence in-place. |
25 |
This Function can return a sorted copy. |
26 |
This Function can return the sum of all values in a sequence. |
27 |
This Function add values to the front of a sequence. |