scalikephp

ArraySeq extends Seq Uses ArraySupport, SeqOps

A Seq implementation using array.

Table of Contents

__construct()  : mixed
Constructor.
append()  : Seq
Returns a new sequence containing the elements from this sequence followed by the elements from `$that`.
computed()  : Seq
Returns the evaluated sequence.
contains()  : bool
Tests whether this sequence contains a given value as an element.
count()  : int
create()  : Seq
Returns a Seq of values generated by closure.
distinct()  : Seq
Selects all the elements of this sequence ignoring the duplicates.
distinctBy()  : Seq
Selects all the elements of this sequence ignoring the duplicates as determined by `===` after applying the transforming function `$f`.
drop()  : Seq
each()  : void
Apply `$f` to each element for its side effects.
empty()  : Seq
Returns the empty Seq.
emptySeq()  : Seq
Returns the empty Seq.
exists()  : bool
Tests whether a predicate holds for at least one element of this collection.
filter()  : Seq
filterNot()  : static
Selects all elements of this collection which do not satisfy a predicate.
find()  : Option
Finds the first element of this collection satisfying a predicate, if any.
flatMap()  : Seq
flatten()  : Seq
fold()  : mixed
forAll()  : bool
Tests whether a predicate holds for all elements of this collection.
from()  : Seq
Returns a Seq of items.
fromArray()  : Seq
Returns a Seq from iterable.
fromTraversable()  : Seq
Returns a Seq from a Traversable.
generate()  : Generator
Creates a new {@link Generator} from this collection.
getIterator()  : Traversable
groupBy()  : Map
head()  : mixed
Selects the first element of this collection.
headOption()  : Option
Optionally selects the first element.
indexOf()  : int
Finds index of first occurrence of some value in this sequence.
isEmpty()  : bool
jsonSerialize()  : array<string|int, mixed>
last()  : mixed
Selects the last element of this collection.
lastOption()  : Option
Optionally selects the last element.
map()  : Seq
max()  : mixed
maxBy()  : mixed
merge()  : Seq
Returns a Seq from given iterables.
min()  : mixed
minBy()  : mixed
mkString()  : string
Returns all elements of this collection in a string using a separator string.
nonEmpty()  : bool
Tests whether this collection is not empty.
offsetExists()  : bool
PHP magic method: offsetExists.
offsetGet()  : mixed
PHP magic method: offsetGet.
offsetSet()  : void
PHP magic method: offsetSet.
offsetUnset()  : void
PHP magic method: offsetUnset.
partition()  : array<string|int, mixed>|array<string|int, Seq>
prepend()  : Seq
Returns a new sequence containing the elements from `$that` followed by the elements from this sequence.
reverse()  : Seq
Returns new sequence with elements in reversed order.
size()  : int
sortBy()  : Seq
Sorts this sequence according to the ordering with a transformation function.
sum()  : float|int
Sums up the elements of this collection.
sumBy()  : mixed
tail()  : static
Returns rest of this collection without its first element.
take()  : Seq
takeRight()  : Seq
toArray()  : array<string|int, mixed>
toGenerator()  : Generator
toMap()  : Map
Converts this sequence to a Map.
toSeq()  : Seq

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $values) : mixed

The constructor of ArraySeq.

Parameters
$values : array<string|int, mixed>
Return values
mixed

append()

Returns a new sequence containing the elements from this sequence followed by the elements from `$that`.

public abstract append(iteratable<string|int, mixed> $that) : Seq
Parameters
$that : iteratable<string|int, mixed>

the iterable to append.

Return values
Seq

computed()

Returns the evaluated sequence.

public computed() : Seq
Return values
Seq

contains()

Tests whether this sequence contains a given value as an element.

public abstract contains(mixed $elem) : bool
Parameters
$elem : mixed

the element to test.

Return values
bool

true if this sequence has an element that is equal (as determined by ===) to $elem, false otherwise.

create()

Returns a Seq of values generated by closure.

public final static create(Closure $f) : Seq
Parameters
$f : Closure
Return values
Seq

distinct()

Selects all the elements of this sequence ignoring the duplicates.

public abstract distinct() : Seq
Return values
Seq

a new sequence consisting of all the elements of this sequence without duplicates.

distinctBy()

Selects all the elements of this sequence ignoring the duplicates as determined by `===` after applying the transforming function `$f`.

public abstract distinctBy(Closure $f) : Seq
Parameters
$f : Closure

the transforming function whose result is used to determine the uniqueness of each element.

Return values
Seq

a new sequence consisting of all the elements of this sequence without duplicates.

drop()

public drop(int $n) : Seq
Parameters
$n : int
Return values
Seq

each()

Apply `$f` to each element for its side effects.

public each(Closure $f) : void
Parameters
$f : Closure

the function to apply to each element.

Return values
void

empty()

Returns the empty Seq.

public final static empty() : Seq
Return values
Seq

emptySeq()

Returns the empty Seq.

public final static emptySeq() : Seq
Tags
deprecated

Use Seq::empty() instead.

Return values
Seq

exists()

Tests whether a predicate holds for at least one element of this collection.

public exists(Closure $p) : bool
Parameters
$p : Closure

the predicate used to test elements.

Return values
bool

true if the given predicate $p is satisfied by at least one element of this collection, otherwise false.

filter()

public filter(Closure $p) : Seq
Parameters
$p : Closure
Return values
Seq

filterNot()

Selects all elements of this collection which do not satisfy a predicate.

public filterNot(Closure $p) : static
Parameters
$p : Closure

the predicate used to test elements.

Return values
static

a new collection consisting of all elements of this collection that satisfy the given predicate $p.

find()

Finds the first element of this collection satisfying a predicate, if any.

public find(Closure $p) : Option
Parameters
$p : Closure

the predicate used to test elements.

Return values
Option

an Option containing the first element in this collection that satisfies $p, or None if none exists.

flatMap()

public flatMap(Closure $f) : Seq
Parameters
$f : Closure
Return values
Seq

fold()

public fold(mixed $z, Closure $op) : mixed
Parameters
$z : mixed
$op : Closure
Return values
mixed

forAll()

Tests whether a predicate holds for all elements of this collection.

public forAll(Closure $p) : bool
Parameters
$p : Closure

the predicate used to test elements.

Return values
bool

true if this collection is empty or the given predicate p holds for all elements of this collection, otherwise false.

from()

Returns a Seq of items.

public final static from(array<string|int, mixed> ...$items) : Seq
Parameters
$items : array<string|int, mixed>
Return values
Seq

fromArray()

Returns a Seq from iterable.

public final static fromArray(null|iteratable<string|int, mixed> $iterable) : Seq
Parameters
$iterable : null|iteratable<string|int, mixed>
Tags
throws
InvalidArgumentException
Return values
Seq

fromTraversable()

Returns a Seq from a Traversable.

public final static fromTraversable(Traversable $traversable) : Seq
Parameters
$traversable : Traversable
Return values
Seq

generate()

Creates a new {@link Generator} from this collection.

public generate(Closure $f) : Generator
Parameters
$f : Closure

the function to apply to each element. it should returns a .

Return values
Generator

getIterator()

public getIterator() : Traversable
Return values
Traversable

groupBy()

public groupBy(mixed $f) : Map
Parameters
$f : mixed
Return values
Map

head()

Selects the first element of this collection.

public head() : mixed
Return values
mixed

the first element of this collection.

headOption()

Optionally selects the first element.

public headOption() : Option
Return values
Option

the first element of this collection if it is non-empty, None if it is empty.

indexOf()

Finds index of first occurrence of some value in this sequence.

public indexOf(mixed $elem) : int
Parameters
$elem : mixed

the element value to search for.

Return values
int

the index >= 0 of the first element of this sequence that is equal (as determined by ===) to elem, or -1, if none exists.

isEmpty()

public isEmpty() : bool
Return values
bool

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

last()

Selects the last element of this collection.

public last() : mixed
Return values
mixed

the last element of this collection.

lastOption()

Optionally selects the last element.

public lastOption() : Option
Return values
Option

the last element of this collection if it is non-empty, None if it is empty.

map()

public map(Closure $f) : Seq
Parameters
$f : Closure
Return values
Seq

max()

public max() : mixed
Return values
mixed

maxBy()

public maxBy(Closure $f) : mixed
Parameters
$f : Closure
Return values
mixed

merge()

Returns a Seq from given iterables.

public final static merge(array<string|int, iteratable<string|int, mixed>> ...$iterables) : Seq
Parameters
$iterables : array<string|int, iteratable<string|int, mixed>>
Return values
Seq

min()

public min() : mixed
Return values
mixed

minBy()

public minBy(Closure $f) : mixed
Parameters
$f : Closure
Return values
mixed

mkString()

Returns all elements of this collection in a string using a separator string.

public mkString([string $sep = '' ]) : string
Parameters
$sep : string = ''

the separator string.

Return values
string

a string representation of this collection. In the resulting string the string representations (w.r.t. the method __toString) of all elements of this collection are separated by the string sep.

nonEmpty()

Tests whether this collection is not empty.

public nonEmpty() : bool
Return values
bool

true if this collection does not contain any elements, false otherwise.

offsetExists()

PHP magic method: offsetExists.

public offsetExists( $offset) : bool
Parameters
$offset :
Return values
bool

offsetGet()

PHP magic method: offsetGet.

public offsetGet( $offset) : mixed
Parameters
$offset :
Return values
mixed

offsetSet()

PHP magic method: offsetSet.

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Return values
void

offsetUnset()

PHP magic method: offsetUnset.

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Return values
void

partition()

public partition(Closure $p) : array<string|int, mixed>|array<string|int, Seq>
Parameters
$p : Closure
Return values
array<string|int, mixed>|array<string|int, Seq>

prepend()

Returns a new sequence containing the elements from `$that` followed by the elements from this sequence.

public abstract prepend(iteratable<string|int, mixed> $that) : Seq
Parameters
$that : iteratable<string|int, mixed>

the iterable to prepend.

Return values
Seq

reverse()

Returns new sequence with elements in reversed order.

public abstract reverse() : Seq
Return values
Seq

sortBy()

Sorts this sequence according to the ordering with a transformation function.

public abstract sortBy(Closure|string $f) : Seq
Parameters
$f : Closure|string

the transformation function or key of each element.

Return values
Seq

a sequence consisting of the elements of this sequence sorted.

sum()

Sums up the elements of this collection.

public sum() : float|int
Return values
float|int

the sum of all elements of this collection.

sumBy()

public sumBy(Closure $f) : mixed
Parameters
$f : Closure
Return values
mixed

tail()

Returns rest of this collection without its first element.

public tail() : static
Return values
static

take()

public take(int $n) : Seq
Parameters
$n : int
Return values
Seq

takeRight()

public takeRight(int $n) : Seq
Parameters
$n : int
Return values
Seq

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toGenerator()

public toGenerator() : Generator
Return values
Generator

toMap()

Converts this sequence to a Map.

public abstract toMap(Closure|string $key) : Map
Parameters
$key : Closure|string
Tags
throws
InvalidArgumentException
Return values
Map

Search results