Package edu.jas.util
Class ListUtil
java.lang.Object
edu.jas.util.ListUtil
List utilities. For example map functor on list elements.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> booleanTest two iterables for equal contents and sequence.static <C> List<C> fill(int n, C e) Create a list of given length and content.map(List<C> list, UnaryFunctor<C, D> f) Map a unary function to the list.tupleFromList(List<List<C>> A) Tuple from lists.
-
Constructor Details
-
ListUtil
public ListUtil()
-
-
Method Details
-
map
public static <C extends Element<C>,D extends Element<D>> List<D> map(List<C> list, UnaryFunctor<C, D> f) Map a unary function to the list.- Parameters:
f- evaluation functor.- Returns:
- new list elements f(list(i)).
-
tupleFromList
Tuple from lists.- Parameters:
A- list of lists.- Returns:
- new list with tuples (a_1,...,an) with ai in Ai, i=0,...,length(A)-1.
-
fill
Create a list of given length and content.- Parameters:
n- length of new liste- object to be filled in- Returns:
- list (e, ..., e) of length n
-
equals
Test two iterables for equal contents and sequence.- Parameters:
a- iterableb- iterable- Returns:
- true, if a equals b in sequence and content, else false.
-