Pages

Wednesday, March 26, 2014

The KeyedIterable interface

The KeyedIterable<Tk, Tv> interface 

(HHVM >= 2.5)

Introduction 

Interface to create an an iterable object that will work with mechanisms like foreach (e.g., foreach($c as $k => $v).

Interface synopsis 

KeyedIterable<Tk, Tv> extends KeyedTraversable<Tk, Tv> extends Iterable<Tv> {
/* Methods */
abstract public KeyedIterator<Tk, Tv> getIterator ( void )
abstract public array toKeysArray ( void )
abstract public Map<Tk, Tv> toMap ( void )
abstract public KeyedIterable<Tk, Tv> keyedIterable<Tk, Tv>::keys ( void )
abstract public KeyedIterable<Tk, Tv> lazy ( void )
abstract public KeyedIterable<Tk, Tu> map<Tu> ( function(Tv): Tu $callback )
abstract public KeyedIterable<Tk, Tu> mapWithKey<Tu> ( function(Tk, Tv): Tu $callback )
abstract public KeyedIterable<Tk, sTv> filter ( function(Tv): bool $callback )
abstract public KeyedIterable<Tk, sTv> filterWithKey ( function(Tk, Tv): bool $callback )
abstract public KeyedIterable<Tk, Pair<Tv, Tu>> zip<Tu> ( Traversable<Tu> $iterable )
/* Inherited methods */
abstract public Iterator<Tv> Iterable<Tv>::getIterator ( void )
abstract public array Iterable<TV>::toArray ( void )
abstract public array Iterable<TV>::toValuesArray ( void )
abstract public Vector<Tv> Iterable<Tv>::toVector ( void )
abstract public Vector<Tv> Iterable<Tv>::toImmVector ( void )
abstract public Set<Tv> Iterable<Tv>::toVector ( void )
abstract public Iterable<Tv> Iterable<Tv>::values ( void )
abstract public Iterable<Tv> Iterable<Tv>::lazy ( void )
abstract public Iterable<Tu> Iterable<Tv>::map<Tu> ( function(Tv): Tu $callback )
abstract public Iterable<Tv> Iterable<Tv>::filter ( function(Tv): bool $callback )
abstract public Iterable<Pair<Tv, Tu>> Iterable<Tv>::zip<Tu> ( Traversable<Tu> $iterable )
}

Table of Contents 

  • KeyedIterable<Tk, Tv>::getIterator — Retrieve an external iterator
  • KeyedIterable<Tk, TV>::toKeysArray — Convert an iterable to an array of the keys of the iterable, keyed by integers.
  • KeyedIterable<Tk, Tv>::toMap — Convert an iterable to a map
  • KeyedIterable<Tk, Tv>::keys — Return an iterable of this iterable's keys.
  • KeyedIterable<Tk, Tv>::lazy — Return a lazy iterable based on this underlying iterable.
  • KeyedIterable<Tk, Tv>::map<Tu> — Return an iterable based on the return results of calling a provided function on every value of this iterable.
  • KeyedIterable<Tk, Tv>::mapWithKey<Tu> — Return an iterable based on the return results of calling a provided function on every value of this iterable.
  • KeyedIterable<Tk, Tv>::filter — Return an iterable containing the values of this iterable that cause the provided function to return true.
  • KeyedIterable<Tk, Tv>::filterWithKey — Return an iterable containing the values of this iterable that cause the provided function to return true.
  • KeyedIterable<Tk, Tv>::zip<Tu> — Return an iterable that combines the elements of this iterable and another provided iterable, pair-wise.

KeyedIterable<Tk, Tv>::getIterator

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::getIterator  Retrieve an external iterator

Description 

abstract public KeyedIterator<Tk, Tv> KeyedIterable<Tk, Tv>::getIterator ( void )
Returns an external iterator.

Parameters 

This function has no parameters.

Return Values 

An instance of an object implementing KeyedIterator<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, TV>::toKeysArray

(HHVM >= 2.5)
KeyedIterable<Tk, TV>::toKeysArray  Convert an iterable to an array of the keys of the iterable, keyed by integers.

Description 

abstract public array KeyedIterable<Tk, Tv>::toKeysArray ( void )
Converts an iterable to an array of the keys of the iterable, keyed by integers.

Parameters 

This function has no parameters.

Return Values 

An array.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::toMap

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::toMap  Convert an iterable to a map

Description 

abstract public Map<Tk, Tv> KeyedIterable<Tk, Tv>::toMap ( void )
Converts an iterable to a map.

Parameters 

This function has no parameters.

Return Values 

A Map<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::keys

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::keys  Return an iterable of this iterable's keys.

Description 

abstract public KeyedIterable<Tk, Tv> keyedIterable<Tk, Tv>::keys ( void )
Returns an iterable of this iterable's values.

Parameters 

This function has no parameters.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::lazy

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::lazy  Return a lazy iterable based on this underlying iterable.

Description 

abstract public KeyedIterable<Tk, Tv> KeyedIterable<Tk, Tv>::lazy ( void )
Returns a lazy iterable based on this underlying iterable. Any change to the underlying iterable will be reflected in the returned lazy iterable.

Parameters 

This function has no parameters.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::map<Tu>

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::map<Tu>  Return an iterable based on the return results of calling a provided function on every value of this iterable.

Description 

abstract public KeyedIterable<Tk, Tu> KeyedIterable<Tk, Tv>::map<Tu> ( function(Tv): Tu$callback )
Returns an iterable based on the return results of calling a provided function on every value of this iterable.

Parameters 

callback
The function callback to map to this iterable.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::mapWithKey<Tu>

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::mapWithKey<Tu>  Return an iterable based on the return results of calling a provided function on every value of this iterable.

Description 

abstract public KeyedIterable<Tk, Tu> KeyedIterable<Tk, Tv>::mapWithKey<Tu> (function(Tk, Tv): Tu $callback )
Returns an iterable based on the return results of calling a provided function on every value of this iterable.

Parameters 

callback
The function callback to map to this iterable.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::filter

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::filter  Return an iterable containing the values of this iterable that cause the provided function to return true.

Description 

abstract public KeyedIterable<Tk, sTv> KeyedIterable<Tk, Tv>::filter ( function(Tv): bool$callback )
Returns an iterable containing the values of this iterable that cause the provided function to return true.

Parameters 

callback
The function callback that filters this iterable.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::filterWithKey

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::filterWithKey  Return an iterable containing the values of this iterable that cause the provided function to return true.

Description 

abstract public KeyedIterable<Tk, sTv> KeyedIterable<Tk, Tv>::filterWithKey (function(Tk, Tv): bool $callback )
Returns an iterable containing the values of this iterable that cause the provided function to return true.

Parameters 

callback
The function callback that filters this iterable.

Return Values 

A KeyedIterable<Tk, Tv>

Errors/Exceptions 

Throws an Exception on failure.

KeyedIterable<Tk, Tv>::zip<Tu>

(HHVM >= 2.5)
KeyedIterable<Tk, Tv>::zip<Tu>  Return an iterable that combines the elements of this iterable and another provided iterable, pair-wise.

Description 

abstract public KeyedIterable<Tk, Pair<Tv, Tu>> KeyedIterable<Tk, Tv>::zip<Tu> (Traversable<Tu> $iterable )
Returns an iterable that combines the elements of this iterable and another provided iterable, pair-wise.

Parameters 

iterable
The iterable with the elements to combine with the elements of this iterable.

Return Values 

A KeyedIterable<Tk, Tv>.

Errors/Exceptions 

Throws an Exception on failure.


















No comments:

Post a Comment