Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r641231 | skestle | 2008-03-26 02:58:51 -0700 (Wed, 26 Mar 2008) | 1 line Started incorporating Edwin's patch for COLLECTIONS-253, in preparation for COLLECTIONS-290. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815053 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
79efcdac2a
commit
8fe2b4eed0
|
@ -27,14 +27,27 @@ import org.apache.commons.collections.Predicate;
|
||||||
* @version $Revision$ $Date$
|
* @version $Revision$ $Date$
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
|
* @author Stephen Kestle
|
||||||
*/
|
*/
|
||||||
public final class TruePredicate implements Predicate, Serializable {
|
public final class TruePredicate<T> implements Predicate<T>, Serializable {
|
||||||
|
|
||||||
/** Serial version UID */
|
/** Serial version UID */
|
||||||
private static final long serialVersionUID = 3374767158756189740L;
|
private static final long serialVersionUID = 3374767158756189740L;
|
||||||
|
|
||||||
/** Singleton predicate instance */
|
/** Singleton predicate instance */
|
||||||
public static final Predicate INSTANCE = new TruePredicate();
|
public static final Predicate<?> INSTANCE = new TruePredicate<Object>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory returning the singleton instance.
|
||||||
|
*
|
||||||
|
* @return the singleton instance
|
||||||
|
* @since Commons Collections 3.1
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static <T> Predicate<T> getInstance() {
|
||||||
|
return truePredicate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory returning the singleton instance.
|
* Factory returning the singleton instance.
|
||||||
|
@ -42,8 +55,9 @@ public final class TruePredicate implements Predicate, Serializable {
|
||||||
* @return the singleton instance
|
* @return the singleton instance
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
*/
|
*/
|
||||||
public static Predicate getInstance() {
|
@SuppressWarnings("unchecked")
|
||||||
return INSTANCE;
|
public static <T> Predicate<T> truePredicate() {
|
||||||
|
return (Predicate<T>) INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,8 +73,7 @@ public final class TruePredicate implements Predicate, Serializable {
|
||||||
* @param object the input object
|
* @param object the input object
|
||||||
* @return true always
|
* @return true always
|
||||||
*/
|
*/
|
||||||
public boolean evaluate(Object object) {
|
public boolean evaluate(T object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue