|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.algorithms.ListAlgorithms
public class ListAlgorithms
Algorithms that modify a given list. Unlike the static algorithm classes within this package, this class will change the contents of its input.
Copyright © 2007 David A. Hall
Constructor Summary | |
---|---|
ListAlgorithms()
|
Method Summary | ||
---|---|---|
static
|
filter(LT list,
UnaryFunctor<T,java.lang.Boolean> uf)
Removes all elements from the list that do not meet the given selection criteria. |
|
static
|
remove(LT list,
T value)
removes all elements equal to the given value from the list, |
|
static
|
remove(LT list,
T value,
Equality<T> eq)
removes elements equal to the given value from the list, using the given functor to compare for equality. |
|
static
|
remove(LT list,
UnaryFunctor<T,java.lang.Boolean> pred)
removes elements from the list that do meet the given selection criteria |
|
static
|
replace(LT list,
T value,
T replacement)
Replaces elements equal to the given value with the given replacement value. |
|
static
|
replace(LT list,
UnaryFunctor<T,java.lang.Boolean> test,
T replacement)
Tests each element in the list, and replaces elements that pass with the given value. |
|
static
|
replace(LT list,
UnaryFunctor<T,java.lang.Boolean> test,
UnaryFunctor<T,T> fn)
Tests each element in the list, and replaces elements that pass with the result of passing the element to the given replacement function. |
|
static
|
reverse(LT list)
Reverses the order of the list. |
|
static
|
transform(LT list,
UnaryFunctor<T,T> uf)
Applies the UnaryFunctor to each element in the list, replacing each element with the result. |
|
static
|
unique(LT list)
Removes all adjacent duplicate values in the given list, using equals() to compare adjacent elements. |
|
static
|
unique(LT list,
BinaryFunctor<T,T,java.lang.Boolean> eq)
Deprecated. use Unique.unique(Iterable,BinaryFunctor) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListAlgorithms()
Method Detail |
---|
public static <T,LT extends java.util.List<? extends T>> LT filter(LT list, UnaryFunctor<T,java.lang.Boolean> uf)
public static <T,LT extends java.util.List<? extends T>> LT remove(LT list, T value)
public static <T,LT extends java.util.List<? extends T>> LT remove(LT list, T value, Equality<T> eq)
public static <T,LT extends java.util.List<? extends T>> LT remove(LT list, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T,LT extends java.util.List<T>> LT transform(LT list, UnaryFunctor<T,T> uf)
public static <T,LT extends java.util.List<T>> LT replace(LT list, T value, T replacement)
public static <T,LT extends java.util.List<T>> LT replace(LT list, UnaryFunctor<T,java.lang.Boolean> test, T replacement)
public static <T,LT extends java.util.List<T>> LT replace(LT list, UnaryFunctor<T,java.lang.Boolean> test, UnaryFunctor<T,T> fn)
public static <T,LT extends java.util.List<T>> LT reverse(LT list)
public static <T,LT extends java.util.List<? extends T>> LT unique(LT list)
public static <T,LT extends java.util.List<? extends T>> LT unique(LT list, BinaryFunctor<T,T,java.lang.Boolean> eq)
Unique.unique(Iterable,BinaryFunctor)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |