|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.util.Match<T>
public abstract class Match<T>
A utilty for seeing which elements in a collection satisfy a given condition.
An instance of match allows you to test that an object matches some condition.
Static utility methods allow you to find what elements in a collection satisfy a match,
count the number of matches, see if any elements match etc.
| Field Summary | |
|---|---|
static Match |
ALWAYS_MATCH
A match that always returns true. |
static Match |
NEVER_MATCH
A match that always returns false. |
| Constructor Summary | |
|---|---|
Match()
|
|
| Method Summary | ||
|---|---|---|
static
|
allMatch(java.util.Collection<T> collection,
Match<T> aMatch)
returns true if all elements in the collection match. |
|
static
|
countMatches(java.util.Collection<T> collection,
Match<T> aMatch)
Returns the number of matches found. |
|
static
|
getKeysWhereValueMatch(java.util.Map<K,V> aMap,
Match<V> valueMatch)
return the keys where the value keyed by the key matches valueMatch |
|
static
|
getMatches(java.util.Collection<T> collection,
Match<T> aMatch)
Returns the elements of the collection that match. |
|
static
|
getNMatches(java.util.Collection<T> collection,
int max,
Match<T> aMatch)
Only returns the first n matches. |
|
Match<T> |
invert()
|
|
abstract boolean |
match(T o)
Subclasses must override this method. |
|
static
|
noneMatch(java.util.Collection<T> collection,
Match<T> aMatch)
Returns true if no matches could be found. |
|
static
|
someMatch(java.util.Collection<T> collection,
Match<T> aMatch)
Returns true if any matches could be found. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Match ALWAYS_MATCH
public static final Match NEVER_MATCH
| Constructor Detail |
|---|
public Match()
| Method Detail |
|---|
public static final <T> java.util.List<T> getMatches(java.util.Collection<T> collection,
Match<T> aMatch)
public static final <T> java.util.List<T> getNMatches(java.util.Collection<T> collection,
int max,
Match<T> aMatch)
public static final <T> boolean allMatch(java.util.Collection<T> collection,
Match<T> aMatch)
public static final <T> boolean someMatch(java.util.Collection<T> collection,
Match<T> aMatch)
public static final <T> boolean noneMatch(java.util.Collection<T> collection,
Match<T> aMatch)
public static final <T> int countMatches(java.util.Collection<T> collection,
Match<T> aMatch)
public static <K,V> java.util.Set<K> getKeysWhereValueMatch(java.util.Map<K,V> aMap,
Match<V> valueMatch)
public abstract boolean match(T o)
public final Match<T> invert()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||