|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.collect.CollectUtil
public final class CollectUtil
| Field Summary | |
|---|---|
static Predicate2<java.util.Set<?>,java.lang.Object> |
SET_CONTENTS_PREDICATE
A predicate that accepts Set-Object pairs such that the given object is contained by the set. |
static Order<java.lang.String> |
STRING_PREFIX_ORDER
A partial order checking whether the first element is a prefix of the second; implemented with String.contains(java.lang.CharSequence). |
static Order<java.lang.Iterable<?>> |
SUBSET_ORDER
A partial order checking whether the first element is a subset of the second; implemented with IterUtil.containsAll(java.lang.Iterable>, java.lang.Iterable>) and Collection.containsAll(java.util.Collection>). |
static Order<java.lang.String> |
SUBSTRING_ORDER
A partial order checking whether the first element is a substring of the second; implemented with String.contains(java.lang.CharSequence). |
| Method Summary | ||
|---|---|---|
static
|
addAll(java.util.Collection<E> c,
java.lang.Iterable<? extends E> elts)
Add the given elements to a collection. |
|
static
|
arrayListFactory()
Get a factory that produces ArrayLists by invoking the empty ArrayList constructor. |
|
static
|
arrayListFactory(int initialCapacity)
Get a factory that produces ArrayLists with the given initial capacity. |
|
static
|
asCollection(java.lang.Iterable<T> iter)
Convert the given Iterable to a Collection. |
|
static
|
asLambdaMap(java.util.Map<K,V> m)
Convert the given Map to a LambdaMap. |
|
static
|
asMap(java.util.Dictionary<K,V> d)
Convert a Dictionary to a Map. |
|
static
|
asPredicateSet(java.lang.Iterable<T> iter)
Convert the given Iterable to a PredicateSet. |
|
static
|
asSet(java.lang.Iterable<T> iter)
Convert the given Iterable to a Set. |
|
static
|
asTotalOrder(java.util.Comparator<? super T> comp)
Wrap a Comparator as a TotalOrder. |
|
static
|
castIfContains(java.util.Collection<? extends T> c,
java.lang.Object obj)
Cast the given object to a collection element type if that object is contained by the collection. |
|
static
|
complement(Relation<T1,T2> domain,
Relation<? super T1,? super T2> excluded)
Produce the complement of a relation in a domain, or, equivalently, the difference of two relations. |
|
static
|
complement(Relation<T1,T2> domain,
T1 first,
T2 second)
Produce the complement of a singleton in a domain relation, or, equivalently, a relation with a certain entry removed. |
|
static
|
complement(java.util.Set<? extends T> domain,
java.util.Set<?> excluded)
Produce the complement of a set in a domain, or, equivalently, the difference of two sets. |
|
static
|
complement(java.util.Set<? extends T> domain,
T excluded)
Produce the complement of a singleton in a domain set, or, equivalently, a set with a certain element removed. |
|
static
|
compose(java.util.Map<? extends K,? extends X> left,
java.util.Map<? super X,? extends V> right)
Produce a lazy transitive composition of two maps. |
|
static
|
compose(Relation<T1,T2> left,
Relation<T2,T3> right)
Produce a lazy transitive composition of two relations. |
|
static
|
composeMaxLists(java.lang.Iterable<? extends T> vals1,
java.lang.Iterable<? extends T> vals2,
Order<? super T> order)
Get the maximal elements of the given lists, each known to be a list of maximal elements, based on the given order. |
|
static
|
composeMinLists(java.lang.Iterable<? extends T> vals1,
java.lang.Iterable<? extends T> vals2,
Order<? super T> order)
Get the minimal elements of the given lists, each known to be a list of minimal elements, based on the given order. |
|
static
|
conditionalSnapshot(java.util.Map<K,V> map,
int threshold)
Produce a snapshot of set if its composite size is greater than the given threshold. |
|
static
|
conditionalSnapshot(Relation<T1,T2> rel,
int threshold)
Produce a snapshot of set if its composite size is greater than the given threshold. |
|
static
|
conditionalSnapshot(java.util.Set<T> set,
int threshold)
Produce a snapshot of set if its composite size is greater than the given threshold. |
|
static boolean |
containsAll(java.util.Collection<?> c,
java.lang.Iterable<?> subset)
Test whether a collection contains all the elements of a list. |
|
static boolean |
containsAny(java.util.Collection<?> c,
java.lang.Iterable<?> candidates)
Test whether a collection contains some element of a list. |
|
static
|
copyOnWriteArrayListFactory()
Get a factory that produces CopyOnWriteArraySets by invoking the empty CopyOnWriteArraySet constructor. |
|
static
|
copyOnWriteArraySetFactory()
Get a factory that produces CopyOnWriteArraySets by invoking the empty CopyOnWriteArraySet constructor. |
|
static
|
cross(java.util.Set<? extends T1> left,
java.util.Set<? extends T2> right)
Produce the lazy cartesian (or cross) product of two sets. |
|
static
|
emptyList()
Produce an immutable empty list. |
|
static
|
emptyMap()
Produce an immutable empty map. |
|
static
|
emptyRelation()
Produce an immutable empty relation. |
|
static
|
emptySet()
Produce an immutable empty set. |
|
static
|
filter(Relation<T1,T2> relation,
Predicate2<? super T1,? super T2> pred)
Lazily filter the given relation. |
|
static
|
filter(java.util.Set<? extends T> set,
Predicate<? super T> predicate)
Lazily filter the given set. |
|
static
|
functionClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends T> function)
Produce the set containing the elements in base and all values produced an arbitrary number
of applications of function to one of these elements. |
|
static
|
functionClosure(T base,
Lambda<? super T,? extends T> function)
Produce the set containing base and all values produced an arbitrary number of applications
of function to base. |
|
static
|
graphClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends java.lang.Iterable<? extends T>> neighbors)
Produce the set of all nodes reachable from the elements in base in a directed graph defined by
neighbors. |
|
static
|
graphClosure(T base,
Lambda<? super T,? extends java.lang.Iterable<? extends T>> neighbors)
Produce the set of all nodes reachable from base in a directed graph defined by neighbors. |
|
static
|
hashMapFactory()
Get a factory that produces HashMaps by invoking the empty HashMap constructor. |
|
static
|
hashMapFactory(int initialCapacity)
Get a factory that produces HashMaps with the given initial capacity. |
|
static
|
hashSetFactory()
Get a factory that produces HashSets by invoking the empty HashSet constructor. |
|
static
|
hashSetFactory(int initialCapacity)
Get a factory that produces HashSets with the given initial capacity. |
|
static
|
immutable(java.util.Map<? extends K,? extends V> map)
Wrap a map in an immutable wrapper. |
|
static
|
immutable(Relation<T1,T2> r)
Wrap a relation in an immutable wrapper. |
|
static
|
immutable(java.util.Set<? extends T> set)
Wrap a set in an immutable wrapper. |
|
static
|
intersection(Relation<T1,T2> r1,
Relation<T1,T2> r2)
Produce a lazy intersection of two relations. |
|
static
|
intersection(java.util.Set<?> s1,
java.util.Set<? extends T> s2)
Produce a lazy intersection of two sets. |
|
static
|
inverse(java.util.Comparator<? super T> ord)
Create an inverse of the given comparator (or TotalOrder). |
|
static
|
inverse(Order<? super T> ord)
Create an inverse of the given order. |
|
static
|
linkedHashMapFactory()
Get a factory that produces LinkedHashMaps by invoking the empty LinkedHashMap constructor. |
|
static
|
linkedHashMapFactory(int initialCapacity)
Get a factory that produces LinkedHashMaps with the given initial capacity. |
|
static
|
linkedHashSetFactory()
Get a factory that produces LinkedHashSets by invoking the empty LinkedHashSet constructor. |
|
static
|
linkedHashSetFactory(int initialCapacity)
Get a factory that produces LinkedHashSets with the given initial capacity. |
|
static
|
linkedListFactory()
Get a factory that produces LinkedLists by invoking the empty LinkedList constructor. |
|
static
|
makeArrayList(java.lang.Iterable<? extends T> iter)
Make an ArrayList with the given elements. |
|
static
|
makeConsList(java.lang.Iterable<? extends T> iter)
Make a ConsList with the given elements. |
|
static
|
makeLinkedList(java.lang.Iterable<? extends T> iter)
Make a LinkedList with the given elements. |
|
static
|
makeList(java.lang.Iterable<? extends T> iter)
Make an ArrayList with the given elements. |
|
static
|
makeRelation(java.lang.Iterable<? extends Pair<? extends T1,? extends T2>> pairs)
Create an immutable Relation based on the given elements. |
|
static
|
makeSet(java.lang.Iterable<? extends T> elements)
Create an immutable PredicateSet based on the given elements. |
|
static
|
makeSet(Option<? extends T> opt)
Produce an empty or singleton set based on the given Option. |
|
static
|
makeSet(T... elements)
Create an immutable PredicateSet based on the given elements. |
|
static
|
maxList(java.lang.Iterable<? extends T> vals,
Order<? super T> order)
Get the maximal elements of the given list, based on the given order. |
|
static
|
minList(java.lang.Iterable<? extends T> vals,
Order<? super T> order)
Get the minimal elements of the given list, based on the given order. |
|
static
|
naturalOrder()
Get a TotalOrder based on the natural (compareTo-based) order associated with the given type. |
|
static
|
partialFunctionClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends Option<? extends T>> function)
Produce the set containing the elements in base and all values produced an arbitrary number
of applications of function to one of these elements. |
|
static
|
partialFunctionClosure(T base,
Lambda<? super T,? extends Option<? extends T>> function)
Produce the set containing base and all values produced an arbitrary number of applications
of function to base. |
|
static boolean |
removeAll(java.util.Collection<?> c,
java.lang.Iterable<?> elts)
Remove the given elements from a collection. |
|
static boolean |
retainAll(java.util.Collection<?> c,
java.lang.Iterable<?> elts)
Remove all but the given elements from a collection. |
|
static
|
singleton(T elt)
Create an immutable singleton set. |
|
static
|
singleton(T1 first,
T2 second)
Create an immutable singleton relation. |
|
static
|
singletonMap(K key,
V value)
Create an immutable singleton map. |
|
static
|
snapshot(java.util.List<? extends T> list)
Alias for makeArrayList(java.lang.Iterable extends T>). |
|
static
|
snapshot(java.util.Map<? extends K,? extends V> map)
Invoke the HashMap#HashMap(Map) constructor, and wrap the result as a LambdaMap. |
|
static
|
snapshot(Relation<? extends T1,? extends T2> relation)
Alias for makeRelation(java.lang.Iterable extends edu.rice.cs.plt.tuple.Pair extends T1, ? extends T2>>). |
|
static
|
snapshot(java.util.Set<? extends T> set)
Alias for makeSet(T...). |
|
static
|
snapshotSynchronized(java.util.List<T> l)
Wrap l as a thread-safe list that produces snapshots to support concurrent iteration. |
|
static
|
snapshotSynchronized(java.util.Set<T> s)
Wrap s as a thread-safe set that produces snapshots to support concurrent iteration. |
|
static
|
treeMapFactory()
Get a factory that produces TreeMaps sorted according to the elements' natural order. |
|
static
|
treeMapFactory(java.util.Comparator<? super K> comparator)
Get a factory that produces TreeMaps sorted according to the given comparator. |
|
static
|
treeSetFactory()
Get a factory that produces TreeSets sorted according to the elements' natural order. |
|
static
|
treeSetFactory(java.util.Comparator<? super T> comparator)
Get a factory that produces TreeSets sorted according to the given comparator. |
|
static
|
union(java.util.Map<? extends K,? extends V> parent,
java.util.Map<? extends K,? extends V> child)
Produce a lazy union of two maps, with mappings in child shadowing those in parent. |
|
static
|
union(Relation<T1,T2> r1,
Relation<T1,T2> r2)
Produce a lazy union of two relations. |
|
static
|
union(Relation<T1,T2> rel,
T1 first,
T2 second)
Produce a lazy union of a relation with an additional singleton entry. |
|
static
|
union(java.util.Set<? extends T> s1,
java.util.Set<? extends T> s2)
Produce a lazy union of two sets. |
|
static
|
union(java.util.Set<? extends T> set,
T elt)
Produce a lazy union of a set with an additional singleton element. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Predicate2<java.util.Set<?>,java.lang.Object> SET_CONTENTS_PREDICATE
public static final Order<java.lang.Iterable<?>> SUBSET_ORDER
IterUtil.containsAll(java.lang.Iterable>, java.lang.Iterable>) and Collection.containsAll(java.util.Collection>).
public static final Order<java.lang.String> SUBSTRING_ORDER
String.contains(java.lang.CharSequence).
public static final Order<java.lang.String> STRING_PREFIX_ORDER
String.contains(java.lang.CharSequence).
| Method Detail |
|---|
public static <T> Thunk<java.util.Set<T>> hashSetFactory()
HashSet.HashSet()public static <T> Thunk<java.util.Set<T>> hashSetFactory(int initialCapacity)
HashSet.HashSet(int)public static <T> Thunk<java.util.Set<T>> linkedHashSetFactory()
LinkedHashSet.LinkedHashSet()public static <T> Thunk<java.util.Set<T>> linkedHashSetFactory(int initialCapacity)
LinkedHashSet.LinkedHashSet(int)public static <T extends java.lang.Comparable<? super T>> Thunk<java.util.Set<T>> treeSetFactory()
TreeSet.TreeSet()public static <T> Thunk<java.util.Set<T>> treeSetFactory(java.util.Comparator<? super T> comparator)
TreeSet.TreeSet(Comparator)public static <T> Thunk<java.util.Set<T>> copyOnWriteArraySetFactory()
CopyOnWriteArraySet.CopyOnWriteArraySet()public static <K,V> Thunk<java.util.Map<K,V>> hashMapFactory()
HashMap.HashMap()public static <K,V> Thunk<java.util.Map<K,V>> hashMapFactory(int initialCapacity)
HashMap.HashMap(int)public static <K,V> Thunk<java.util.Map<K,V>> linkedHashMapFactory()
LinkedHashMap.LinkedHashMap()public static <K,V> Thunk<java.util.Map<K,V>> linkedHashMapFactory(int initialCapacity)
LinkedHashMap.LinkedHashMap(int)public static <K extends java.lang.Comparable<? super K>,V> Thunk<java.util.Map<K,V>> treeMapFactory()
TreeMap.TreeMap()public static <K,V> Thunk<java.util.Map<K,V>> treeMapFactory(java.util.Comparator<? super K> comparator)
TreeMap.TreeMap(Comparator)public static <T> Thunk<java.util.List<T>> arrayListFactory()
ArrayList.ArrayList()public static <T> Thunk<java.util.List<T>> arrayListFactory(int initialCapacity)
ArrayList.ArrayList(int)public static <T> Thunk<java.util.List<T>> linkedListFactory()
LinkedList.LinkedList()public static <T> Thunk<java.util.List<T>> copyOnWriteArrayListFactory()
CopyOnWriteArraySet.CopyOnWriteArraySet()public static <T> PredicateSet<T> makeSet(T... elements)
PredicateSet based on the given elements. May depend on a valid
hashCode() implementation.
public static <T> PredicateSet<T> makeSet(java.lang.Iterable<? extends T> elements)
PredicateSet based on the given elements. May depend on a valid
hashCode() implementation.
public static <T> PredicateSet<T> makeSet(Option<? extends T> opt)
public static <T1,T2> Relation<T1,T2> makeRelation(java.lang.Iterable<? extends Pair<? extends T1,? extends T2>> pairs)
Relation based on the given elements. May depend on a valid
hashCode() implementation.
public static <T> java.util.List<T> makeList(java.lang.Iterable<? extends T> iter)
ArrayList with the given elements.
public static <T> java.util.ArrayList<T> makeArrayList(java.lang.Iterable<? extends T> iter)
ArrayList with the given elements.
public static <T> java.util.LinkedList<T> makeLinkedList(java.lang.Iterable<? extends T> iter)
LinkedList with the given elements.
public static <T> ConsList<T> makeConsList(java.lang.Iterable<? extends T> iter)
ConsList with the given elements.
public static <T> java.util.List<T> emptyList()
Collections.emptyList(); defined here for
Java 1.4 compatibility.
public static <T> EmptySet<T> emptySet()
Collections.emptySet(), but the result here is
a PredicateSet. Also defined for Java 1.4 compatibility.
public static <K,V> EmptyMap<K,V> emptyMap()
Collections.emptyMap(), but the result here is
a LambdaMap. Also defined for Java 1.4 compatibility.
public static <T1,T2> EmptyRelation<T1,T2> emptyRelation()
public static <T> SingletonSet<T> singleton(T elt)
Collections.singleton(T), but produces a PredicateSet.
public static <T1,T2> SingletonRelation<T1,T2> singleton(T1 first,
T2 second)
public static <K,V> SingletonMap<K,V> singletonMap(K key,
V value)
Collections.singletonMap(K, V), but produces a LambdaMap.
public static <T> java.util.Set<T> asSet(java.lang.Iterable<T> iter)
Iterable to a Set. If it already is
a Set, cast it as such. Otherwise, create an IterableSet.
public static <T> PredicateSet<T> asPredicateSet(java.lang.Iterable<T> iter)
Iterable to a PredicateSet. If it already is
a PredicateSet, cast it as such. If it is a Set, produce a DelegatingSet.
Otherwise, create an IterableSet.
public static <T> java.util.Collection<T> asCollection(java.lang.Iterable<T> iter)
Iterable to a Collection. If it already is
a Collection, cast it as such. Otherwise, create an IterableCollection.
public static <K,V> LambdaMap<K,V> asLambdaMap(java.util.Map<K,V> m)
Map to a LambdaMap. If it already is
a LambdaMap, cast it as such. Otherwise, create a DelegatingMap.
public static <K,V> java.util.Map<K,V> asMap(java.util.Dictionary<K,V> d)
Hashtable, cast it as a Map.
Otherwise, create a DictionaryMap.
public static <T> PredicateSet<T> immutable(java.util.Set<? extends T> set)
Collections.unmodifiableSet(java.util.Set extends T>),
but produces a PredicateSet.
public static <K,V> java.util.Map<K,V> immutable(java.util.Map<? extends K,? extends V> map)
Collections.unmodifiableMap(java.util.Map extends K, ? extends V>),
but produces a LambdaMap.
public static <T1,T2> ImmutableRelation<T1,T2> immutable(Relation<T1,T2> r)
Collections.unmodifiableSet(java.util.Set extends T>).
public static <T> PredicateSet<T> snapshot(java.util.Set<? extends T> set)
makeSet(T...).
public static <T> java.lang.Iterable<T> conditionalSnapshot(java.util.Set<T> set,
int threshold)
set if its composite size is greater than the given threshold.
ObjectUtil.compositeSize(java.lang.Object)public static <T1,T2> Relation<T1,T2> snapshot(Relation<? extends T1,? extends T2> relation)
makeRelation(java.lang.Iterable extends edu.rice.cs.plt.tuple.Pair extends T1, ? extends T2>>).
public static <T1,T2> Relation<T1,T2> conditionalSnapshot(Relation<T1,T2> rel,
int threshold)
set if its composite size is greater than the given threshold.
ObjectUtil.compositeSize(java.lang.Object)public static <K,V> LambdaMap<K,V> snapshot(java.util.Map<? extends K,? extends V> map)
HashMap#HashMap(Map) constructor, and wrap the result as a LambdaMap.
public static <K,V> java.util.Map<K,V> conditionalSnapshot(java.util.Map<K,V> map,
int threshold)
set if its composite size is greater than the given threshold.
ObjectUtil.compositeSize(java.lang.Object)public static <T> java.util.List<T> snapshot(java.util.List<? extends T> list)
makeArrayList(java.lang.Iterable extends T>).
public static <T> SnapshotSynchronizedSet<T> snapshotSynchronized(java.util.Set<T> s)
s as a thread-safe set that produces snapshots to support concurrent iteration.
SnapshotSynchronizedSetpublic static <T> SnapshotSynchronizedList<T> snapshotSynchronized(java.util.List<T> l)
l as a thread-safe list that produces snapshots to support concurrent iteration.
SnapshotSynchronizedList
public static <T> PredicateSet<T> union(java.util.Set<? extends T> s1,
java.util.Set<? extends T> s2)
public static <T> PredicateSet<T> union(java.util.Set<? extends T> set,
T elt)
public static <T> PredicateSet<T> intersection(java.util.Set<?> s1,
java.util.Set<? extends T> s2)
public static <T> PredicateSet<T> complement(java.util.Set<? extends T> domain,
java.util.Set<?> excluded)
public static <T> PredicateSet<T> complement(java.util.Set<? extends T> domain,
T excluded)
public static <T> PredicateSet<T> filter(java.util.Set<? extends T> set,
Predicate<? super T> predicate)
public static <T1,T2> Relation<T1,T2> cross(java.util.Set<? extends T1> left,
java.util.Set<? extends T2> right)
public static <T1,T2> Relation<T1,T2> union(Relation<T1,T2> r1,
Relation<T1,T2> r2)
public static <T1,T2> Relation<T1,T2> union(Relation<T1,T2> rel,
T1 first,
T2 second)
public static <T1,T2> Relation<T1,T2> intersection(Relation<T1,T2> r1,
Relation<T1,T2> r2)
public static <T1,T2> Relation<T1,T2> complement(Relation<T1,T2> domain,
Relation<? super T1,? super T2> excluded)
public static <T1,T2> Relation<T1,T2> complement(Relation<T1,T2> domain,
T1 first,
T2 second)
public static <T1,T2,T3> Relation<T1,T3> compose(Relation<T1,T2> left,
Relation<T2,T3> right)
public static <T1,T2> Relation<T1,T2> filter(Relation<T1,T2> relation,
Predicate2<? super T1,? super T2> pred)
public static <K,V> LambdaMap<K,V> union(java.util.Map<? extends K,? extends V> parent,
java.util.Map<? extends K,? extends V> child)
child shadowing those in parent.
Size-related operations have poor performance.
public static <K,X,V> LambdaMap<K,V> compose(java.util.Map<? extends K,? extends X> left,
java.util.Map<? super X,? extends V> right)
public static <T> Option<T> castIfContains(java.util.Collection<? extends T> c,
java.lang.Object obj)
Iterator<T> produced by its iterator()
method (the implication being that the object must have type T).
public static boolean containsAny(java.util.Collection<?> c,
java.lang.Iterable<?> candidates)
Collection.containsAll(java.util.Collection>),
IterUtil.or(java.lang.Iterable extends T>, edu.rice.cs.plt.lambda.Predicate super T>)
public static boolean containsAll(java.util.Collection<?> c,
java.lang.Iterable<?> subset)
Collection.containsAll(java.util.Collection>),
defined for arbitrary Iterables. When possible, delegates to c.containsAll().
IterUtil.and(java.lang.Iterable extends T>, edu.rice.cs.plt.lambda.Predicate super T>),
IterUtil.containsAll(java.lang.Iterable>, java.lang.Iterable>)
public static <E> boolean addAll(java.util.Collection<E> c,
java.lang.Iterable<? extends E> elts)
Collection.addAll(java.util.Collection extends E>), defined for arbitrary
Iterables. When possible, delegates to c.addAll().
true if c changed as a result of the call
public static boolean removeAll(java.util.Collection<?> c,
java.lang.Iterable<?> elts)
Collection.removeAll(java.util.Collection>), defined for arbitrary
Iterables. When possible, delegates to c.removeAll().
true if c changed as a result of the call
public static boolean retainAll(java.util.Collection<?> c,
java.lang.Iterable<?> elts)
Collection.retainAll(java.util.Collection>), defined for
arbitrary Iterables. When possible, delegates to c.retainAll().
true if c changed as a result of the call
public static <T> java.util.Set<T> functionClosure(T base,
Lambda<? super T,? extends T> function)
base and all values produced an arbitrary number of applications
of function to base.
public static <T> java.util.Set<T> functionClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends T> function)
base and all values produced an arbitrary number
of applications of function to one of these elements.
public static <T> java.util.Set<T> partialFunctionClosure(T base,
Lambda<? super T,? extends Option<? extends T>> function)
base and all values produced an arbitrary number of applications
of function to base.
public static <T> java.util.Set<T> partialFunctionClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends Option<? extends T>> function)
base and all values produced an arbitrary number
of applications of function to one of these elements.
public static <T> java.util.Set<T> graphClosure(T base,
Lambda<? super T,? extends java.lang.Iterable<? extends T>> neighbors)
base in a directed graph defined by neighbors.
public static <T> java.util.Set<T> graphClosure(java.util.Set<? extends T> base,
Lambda<? super T,? extends java.lang.Iterable<? extends T>> neighbors)
base in a directed graph defined by
neighbors.
public static <T> java.util.List<T> maxList(java.lang.Iterable<? extends T> vals,
Order<? super T> order)
vals either appear in the result or precede some element in the result. Where
two elements are equivalent (each precedes the other), the second will always be
discarded.
public static <T> java.util.List<T> composeMaxLists(java.lang.Iterable<? extends T> vals1,
java.lang.Iterable<? extends T> vals2,
Order<? super T> order)
maxList(IterUtil.compose(vals1, vals2), order),
but the implementation is more efficient, because it can avoid performing redundant comparisons.
public static <T> java.util.List<T> minList(java.lang.Iterable<? extends T> vals,
Order<? super T> order)
vals either appear in the result or are preceded by some element in the result.
Where two elements are equivalent (each precedes the other), the second will always be
discarded.
public static <T> java.util.List<T> composeMinLists(java.lang.Iterable<? extends T> vals1,
java.lang.Iterable<? extends T> vals2,
Order<? super T> order)
minList(IterUtil.compose(vals1, vals2), order),
but the implementation is more efficient, because it can avoid performing redundant comparisons.
public static <T extends java.lang.Comparable<? super T>> TotalOrder<T> naturalOrder()
public static <T> TotalOrder<T> asTotalOrder(java.util.Comparator<? super T> comp)
public static <T> Order<T> inverse(Order<? super T> ord)
public static <T> TotalOrder<T> inverse(java.util.Comparator<? super T> ord)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||