Adventure at Umalu  22nd March, 2013
Rogue-like Dungeon Crawler, written in Java
 All Classes Functions Variables Pages
Classes | Static Public Member Functions | List of all members
jade.util.Lambda Class Reference

Classes

interface  FilterFunc< T >
 
interface  MapFunc< T, R >
 

Static Public Member Functions

static< T > Iterable< T > filter (Iterable< T > iterable, FilterFunc< T > lambda)
 
static< T, R > Iterable< R > map (Iterable< T > iterable, MapFunc< T, R > lambda)
 
static< T, RextendsT >
Iterable< R > 
filterType (Iterable< T > iterable, final Class< R > cls)
 
static< T > T first (Iterable< T > iterable)
 
static< T > List< T > toList (Iterable< T > iterable)
 
static< T > Set< T > toSet (Iterable< T > iterable)
 

Detailed Description

Lambda

contains methods for manipulating

Iterable<T>

. Many of these concepts, such as map and reduce, were borrowed from functional programming.

Member Function Documentation

static <T> Iterable<T> jade.util.Lambda.filter ( Iterable< T >  iterable,
FilterFunc< T >  lambda 
)
static

Returns a new

Iterable<T>

which is all the elements of the given

Iterable<T>

for which the provided

FilterFunc<T>

returns true.

Parameters
<T>the type of the elements being filtered
iterablethe
Iterable<T>
being filtered
lambdareturns true for any element of iterable to be retained
Returns
a filtered copy of iterable
static <T,RextendsT> Iterable<R> jade.util.Lambda.filterType ( Iterable< T >  iterable,
final Class< R >  cls 
)
static

Returns a new

Iterable<R>

containing only the elements of the given

Iterable<T>

which are of type

R

.

Parameters
<T>the type of the elements being filtered
<R>the type of the elements to be retained
iterablethe iterable being queried
clsthe class of
R
Returns
the elements of iterable which are of type
R
static <T> T jade.util.Lambda.first ( Iterable< T >  iterable)
static

Returns the first element of the given

Iterable<T>

.

Parameters
<T>the type of the element being selected
iterablethe
Iterable<T>
being queried
Returns
the first element of the iterable
static <T,R> Iterable<R> jade.util.Lambda.map ( Iterable< T >  iterable,
MapFunc< T, R >  lambda 
)
static

Returns a new

Iterable<R>

which contains every element of the given

Iterable<T>

mapped by the provided

MapFunc<T, R>

.

Parameters
<T>the type of the elements being mapped
<R>the type the elements are being mapped to
iterablethe iterable being mapped
lambdathe mapping function
Returns
a new
Iterable<R>
which is the result of mapping iterable
static <T> List<T> jade.util.Lambda.toList ( Iterable< T >  iterable)
static

Converts an

Iterable<T>

to a new

List<T>

.

Parameters
<T>the type of the elements being converted to a list
iterablethe
Iterable<T>
to be converted
Returns
a new
List<T>
whose contents are that of iterable
static <T> Set<T> jade.util.Lambda.toSet ( Iterable< T >  iterable)
static

Converts an

Iterable<T>

to a new

Set<T>

.

Parameters
<T>the type of the elements being converted to a set
iterablethe
Iterable<T>
to be converted
Returns
a new
Set<T>
whose contents are that of iterable

The documentation for this class was generated from the following file: