|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.util.Algorithms
public class Algorithms
Facade for the Algorithms adapted from STL, defined to work primarily with collections. These algorithms are adapted from STL, with modifications to be consistent with typical java practice. For example, typical STL algorithms are defined with pairs of iterators defining a half-open range over some implied collection. It works in C++ because the STL iterators can be compared for equality. Java iterators are not guaranteed to be comparable to each other by contract, so the same signatures wouldn't work.
Typically, where an STL algorithm would take a pair of iterators, we'll take a collection. Where an STL algorithm would return an iterator, we'll return an iterator. Note that it will always be java.lang.Iterator when using this class: for some of the more powerful uses, use the Iterators class, which will often return an implementation of Iterator that is tailored for the semantics of the algorithm that was called.
The algorithms in this class and the same set of algorithms in the Iterators class will always return the same results when called with identical arguments.
Copyright © 2003-2005 David A. Hall
Constructor Summary | |
---|---|
Algorithms()
Deprecated. |
Method Summary | ||
---|---|---|
static
|
equal(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2)
Deprecated. use c1.equals(c2) instead |
|
static
|
equal(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
BinaryFunctor<T,T,java.lang.Boolean> eq)
Deprecated. use Compare.equal(Iterable,Iterable,BinaryFunctor) instead |
|
static
|
equal(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
java.util.Comparator<T> comp)
Deprecated. use Compare.equal(Iterable,Iterable,Comparator) instead |
|
static
|
forEach(java.util.Collection<? extends T> c,
UnaryFunctor<T,R> fn)
Deprecated. use Summarize.forEach(Iterable,UnaryFunctor) |
|
static
|
lessThan(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2)
Deprecated. use Compare.lessThan(Iterable,Iterable) instead |
|
static
|
lessThan(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
BinaryFunctor<T,T,java.lang.Boolean> lt)
Deprecated. use Compare.lessThan(Iterable,Iterable,BinaryFunctor) instead |
|
static
|
lessThan(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
java.util.Comparator<T> comp)
Deprecated. use Compare.lessThan(Iterable,Iterable,Comparator) instead |
|
static
|
maximum(java.util.Collection<? extends T> c)
Deprecated. Finds the position of the maximum value in a collection using the natural ordering of the collection's elements. |
|
static
|
maximum(java.util.Collection<? extends T> c,
BinaryFunctor<T,T,T> bf)
Deprecated. Finds the position of the maximum value in a collection using the given functor to compare elements. |
|
static
|
maximum(java.util.Collection<? extends T> c,
java.util.Comparator<T> comp)
Deprecated. Finds the position of the maximum value in a collection using the given comparator. |
|
static
|
minimum(java.util.Collection<? extends T> c)
Deprecated. Finds the position of the minimum value in a collection using the natural ordering of the collection's elements. |
|
static
|
minimum(java.util.Collection<? extends T> c,
BinaryFunctor<T,T,T> bf)
Deprecated. Finds the position of the minimum value in a collection using the given functor to compare elements. |
|
static
|
minimum(java.util.Collection<? extends T> c,
java.util.Comparator<T> comp)
Deprecated. Finds the position of the minimum value in a collection using the given comparator. |
|
static
|
removeAll(LT lin,
T value)
Deprecated. use ListAlgorithms.remove(List,Object) |
|
static
|
removeAll(LT lin,
T value,
Equality<T> eq)
Deprecated. use ListAlgorithms.remove(List,Object) |
|
static
|
removeAll(LT lin,
UnaryFunctor<T,java.lang.Boolean> uf)
Deprecated. use ListAlgorithms.remove(List,UnaryFunctor) |
|
static
|
replaceAll(java.util.List<T> lin,
UnaryFunctor<T,java.lang.Boolean> uf,
T value)
Deprecated. use ListAlgorithms.replace(List,UnaryFunctor,Object) |
|
static
|
transform(java.util.List<T> lin,
UnaryFunctor<T,T> uf)
Deprecated. use ListAlgorithms.transform(List,UnaryFunctor) |
|
static
|
unique(LT lin)
Deprecated. use ListAlgorithms.unique(List) |
|
static
|
unique(LT lin,
BinaryFunctor<T,T,java.lang.Boolean> eq)
Deprecated. use ListAlgorithms.unique(List,BinaryFunctor) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Algorithms()
Method Detail |
---|
public static <T,R> UnaryFunctor<T,R> forEach(java.util.Collection<? extends T> c, UnaryFunctor<T,R> fn)
Summarize.forEach(Iterable,UnaryFunctor)
public static <T> boolean equal(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2)
public static <T> boolean equal(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, java.util.Comparator<T> comp)
Compare.equal(Iterable,Iterable,Comparator)
instead
public static <T> boolean equal(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, BinaryFunctor<T,T,java.lang.Boolean> eq)
public static <T extends java.lang.Comparable<? super T>> boolean lessThan(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2)
public static <T> boolean lessThan(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, java.util.Comparator<T> comp)
public static <T> boolean lessThan(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, BinaryFunctor<T,T,java.lang.Boolean> lt)
public static <T extends java.lang.Comparable<? super T>> java.util.Iterator<T> minimum(java.util.Collection<? extends T> c)
public static <T> java.util.Iterator<T> minimum(java.util.Collection<? extends T> c, java.util.Comparator<T> comp)
public static <T> java.util.Iterator<T> minimum(java.util.Collection<? extends T> c, BinaryFunctor<T,T,T> bf)
public static <T extends java.lang.Comparable<? super T>> java.util.Iterator<T> maximum(java.util.Collection<? extends T> c)
public static <T> java.util.Iterator<T> maximum(java.util.Collection<? extends T> c, java.util.Comparator<T> comp)
public static <T> java.util.Iterator<T> maximum(java.util.Collection<? extends T> c, BinaryFunctor<T,T,T> bf)
public static <T> java.util.List<T> transform(java.util.List<T> lin, UnaryFunctor<T,T> uf)
ListAlgorithms.transform(List,UnaryFunctor)
public static <T> java.util.List<T> replaceAll(java.util.List<T> lin, UnaryFunctor<T,java.lang.Boolean> uf, T value)
ListAlgorithms.replace(List,UnaryFunctor,Object)
public static <T,LT extends java.util.List<? extends T>> LT removeAll(LT lin, T value)
ListAlgorithms.remove(List,Object)
public static <T,LT extends java.util.List<? extends T>> LT removeAll(LT lin, T value, Equality<T> eq)
ListAlgorithms.remove(List,Object)
public static <T,LT extends java.util.List<? extends T>> LT removeAll(LT lin, UnaryFunctor<T,java.lang.Boolean> uf)
ListAlgorithms.remove(List,UnaryFunctor)
public static <T,LT extends java.util.List<? extends T>> LT unique(LT lin)
ListAlgorithms.unique(List)
public static <T,LT extends java.util.List<? extends T>> LT unique(LT lin, BinaryFunctor<T,T,java.lang.Boolean> eq)
ListAlgorithms.unique(List,BinaryFunctor)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |