scalikephp

ScalikeTraversable implements ScalikeTraversableInterface

Scala like Traversable Implementation.

Interfaces, Classes and Traits

ScalikeTraversableInterface
Scala like Traversable Interface.

Table of Contents

each()  : void
Apply `$f` to each element for its side effects.
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.
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.
last()  : mixed
Selects the last element of this collection.
lastOption()  : Option
Optionally selects the last element.
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.
sum()  : float|int
Sums up the elements of this collection.
tail()  : static
Returns rest of this collection without its first element.

Methods

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

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.

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

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.

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.

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

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

Search results