@Deprecated public class _ extends Object
List objects.
The '_' character is inspired in Underscore library, and the methods
in the Array class of ruby language.
This class is a wrapper for the methods of api.Helpers| Constructor and Description |
|---|
_()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
all(List<T> list,
ConditionFunction<T> function)
Deprecated.
Returns true if all of the values in the list pass the predicate truth test
|
static <T> boolean |
any(List<T> list,
ConditionFunction<T> function)
Deprecated.
Returns true if any of the values in the list pass the predicate truth test
|
static <T> T |
at(List<T> list,
int index)
Deprecated.
Return the element at index.
|
static <T> void |
compact$(List<T> list)
Deprecated.
Remove null values in list
|
static <T> int |
count(List<T> list)
Deprecated.
Return size of list or 0 to empty list.
|
static <T> int |
count(List<T> list,
ConditionFunction<T> function)
Deprecated.
Return size of list where function returns true, or 0 to empty list.
|
static <T> List<T> |
drop(List<T> list,
int n)
Deprecated.
Get the elements of list excluding the first n elements
|
static <T> void |
each(List<T> list,
EachFunction<T> function)
Deprecated.
Execute a custom action for each element of list.
|
static <T> T |
fetch(List<T> list,
int index)
Deprecated.
Identical to
List.get(int) |
static <T> T |
fetch(List<T> list,
int index,
T def)
Deprecated.
Null-safe, get element at index, with default value.
|
static <T> T |
first(List<T> list)
Deprecated.
Get the first element of list.
|
static <T> boolean |
isEmpty(List<T> list)
Deprecated.
Check if list is empty
|
static <T> boolean |
isNotEmpty(List<T> list)
Deprecated.
Check if list is not empty
|
static <T> T |
last(List<T> list)
Deprecated.
Get the last element of list.
|
static <T> List<T> |
map(List<T> list,
MapFunction<T> function)
Deprecated.
Return a new list of same type element, applying new value for each element.
|
static <T> void |
map$(List<T> list,
MapFunction<T> function)
Deprecated.
Modifing list applying new value for each element.
|
static <T> void |
push(List<T> list,
T... ts)
Deprecated.
Adding multiple elements to the end of list.
|
static <T> ListHelper<T> |
push(List<T> list,
T t)
Deprecated.
Adding element to the end of list.
|
static <T,R> R |
reduce(List<T> list,
R initialValue,
ReduceFunction<T,R> function)
Deprecated.
Transform a list on a single value
|
static <T> List<T> |
reject(List<T> list,
ConditionFunction<T> function)
Deprecated.
Select all elements that condition returns false.
|
static <T> void |
reject$(List<T> list,
ConditionFunction<T> function)
Deprecated.
Select all elements that condition returns false.
|
static <T> List<T> |
select(List<T> list,
ConditionFunction<T> function)
Deprecated.
Select all elements that condition returns true.
|
static <T> void |
select$(List<T> list,
ConditionFunction<T> function)
Deprecated.
Select all elements that condition returns true.
|
static <T> int |
size(List<T> list)
Deprecated.
Identical to List#size()
|
static <T> List<T> |
take(List<T> list,
int n)
Deprecated.
Get the first n elements of list
|
static <T,R> List<R> |
transform(List<T> list,
TransformFunction<T,R> function)
Deprecated.
Return a new list of another type element, applying a function for each element.
|
public static <T> void each(List<T> list, EachFunction<T> function)
list - list of elements to iteratefunction - function to execute in each elementpublic static <T> List<T> map(List<T> list, MapFunction<T> function)
list - list of elements to iteratefunction - function to apply in each value that returns the new valuepublic static <T,R> List<R> transform(List<T> list, TransformFunction<T,R> function)
list - list of elements to iteratefunction - function to apply in each element of listpublic static <T> List<T> select(List<T> list, ConditionFunction<T> function)
list - list of elements to iteratefunction - Apply in each element and select if returns true.public static <T> List<T> reject(List<T> list, ConditionFunction<T> function)
list - list of elements to iteratefunction - Apply in each element and select if returns true.public static <T> void map$(List<T> list, MapFunction<T> function)
list - values list of elementsfunction - function to apply in each value that returns the new valuepublic static <T> void select$(List<T> list, ConditionFunction<T> function)
list - values list of elementsfunction - Apply in each element and select if returns true.public static <T> void reject$(List<T> list, ConditionFunction<T> function)
list - values list of elementsfunction - Apply in each element and select if returns false.public static <T> void compact$(List<T> list)
list - values list of elementspublic static <T> void push(List<T> list, T... ts)
list - values list of elementsts - elements to pushpublic static <T> ListHelper<T> push(List<T> list, T t)
list - values list of elementst - element to pushpublic static <T> T at(List<T> list, int index)
index - index of elementpublic static <T> T fetch(List<T> list, int index)
List.get(int)list - list of elementsindex - index of elementIndexOutOfBoundsExceptionpublic static <T> T fetch(List<T> list, int index, T def)
list - list of elementsindex - index of elementdef - Default valuepublic static <T> T first(List<T> list)
list - list of elementspublic static <T> T last(List<T> list)
list - list of elementspublic static <T> List<T> take(List<T> list, int n)
list - values list of type Tn - number of elementspublic static <T> List<T> drop(List<T> list, int n)
list - list of elementsn - number of elements to excludepublic static <T> boolean isEmpty(List<T> list)
public static <T> boolean isNotEmpty(List<T> list)
public static <T> int size(List<T> list)
list - the list of elementspublic static <T> int count(List<T> list)
public static <T> int count(List<T> list, ConditionFunction<T> function)
list - the list of elementsfunction - the condition to consider element in countpublic static <T> boolean all(List<T> list, ConditionFunction<T> function)
function - apply in each element and return false if one of them failpublic static <T> boolean any(List<T> list, ConditionFunction<T> function)
function - apply in each element and return true if one of them passpublic static <T,R> R reduce(List<T> list, R initialValue, ReduceFunction<T,R> function)
list - list of elementsinitialValue - initial value of the to be returnedfunction - the reduce functionCopyright © 2015. All rights reserved.