Seq extends ScalikeTraversable Uses SeqBuilder
Scala like Seq.
Table of Contents
- 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.
- 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`.
- 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.
- 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.
- 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.
- 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.
- last() : mixed
- Selects the last element of this collection.
- lastOption() : Option
- Optionally selects the last element.
- merge() : Seq
- Returns a Seq from given iterables.
- mkString() : string
- Returns all elements of this collection in a string using a separator string.
- nonEmpty() : bool
- Tests whether this collection is not empty.
- offsetSet() : void
- PHP magic method: offsetSet.
- offsetUnset() : void
- PHP magic method: offsetUnset.
- 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.
- sortBy() : Seq
- Sorts this sequence according to the ordering with a transformation function.
- sum() : float|int
- Sums up the elements of this collection.
- tail() : static
- Returns rest of this collection without its first element.
- toMap() : Map
- Converts this sequence to a Map.
Methods
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
abstract 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.
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
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.
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.
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
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
Return values
Generator —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
abstract 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.
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.
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 —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.
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 —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.
tail()
Returns rest of this collection without its first element.
public
tail() : static
Return values
static —toMap()
Converts this sequence to a Map.
public
abstract toMap(Closure|string $key) : Map
Parameters
- $key : Closure|string