More var-args. Clean-up.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1356957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joerg Schaible 2012-07-03 21:25:08 +00:00
parent 60a3e7c07a
commit 2f4d235479
1 changed files with 11 additions and 12 deletions

View File

@ -67,10 +67,7 @@ import org.apache.commons.collections.functors.UniquePredicate;
* All the supplied predicates are Serializable. * All the supplied predicates are Serializable.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision$ * @version $Id$
*
* @author Stephen Colebourne
* @author Ola Berg
*/ */
public class PredicateUtils { public class PredicateUtils {
@ -284,7 +281,7 @@ public class PredicateUtils {
* @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead. * @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead.
*/ */
@Deprecated @Deprecated
public static <T> Predicate<T> allPredicate(Predicate<? super T>[] predicates) { public static <T> Predicate<T> allPredicate(Predicate<? super T>... predicates) {
return AllPredicate.allPredicate(predicates); return AllPredicate.allPredicate(predicates);
} }
@ -331,7 +328,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null * @throws IllegalArgumentException if any predicate in the array is null
*/ */
public static <T> Predicate<T> anyPredicate(Predicate<? super T>[] predicates) { public static <T> Predicate<T> anyPredicate(Predicate<? super T>... predicates) {
return AnyPredicate.anyPredicate(predicates); return AnyPredicate.anyPredicate(predicates);
} }
@ -362,9 +359,10 @@ public class PredicateUtils {
* @return the <code>either</code> predicate * @return the <code>either</code> predicate
* @throws IllegalArgumentException if either predicate is null * @throws IllegalArgumentException if either predicate is null
*/ */
@SuppressWarnings("unchecked")
public static <T> Predicate<T> eitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) { public static <T> Predicate<T> eitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
return onePredicate(new Predicate[] { predicate1, predicate2 }); @SuppressWarnings("unchecked")
Predicate<T> onePredicate = onePredicate(predicate1, predicate2);
return onePredicate;
} }
/** /**
@ -379,7 +377,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null * @throws IllegalArgumentException if any predicate in the array is null
*/ */
public static <T> Predicate<T> onePredicate(Predicate<? super T>[] predicates) { public static <T> Predicate<T> onePredicate(Predicate<? super T>... predicates) {
return OnePredicate.onePredicate(predicates); return OnePredicate.onePredicate(predicates);
} }
@ -410,9 +408,10 @@ public class PredicateUtils {
* @return the <code>neither</code> predicate * @return the <code>neither</code> predicate
* @throws IllegalArgumentException if either predicate is null * @throws IllegalArgumentException if either predicate is null
*/ */
@SuppressWarnings("unchecked")
public static <T> Predicate<T> neitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) { public static <T> Predicate<T> neitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
return nonePredicate(new Predicate[] { predicate1, predicate2 }); @SuppressWarnings("unchecked")
Predicate<T> nonePredicate = nonePredicate(predicate1, predicate2);
return nonePredicate;
} }
/** /**
@ -427,7 +426,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null * @throws IllegalArgumentException if any predicate in the array is null
*/ */
public static <T> Predicate<T> nonePredicate(Predicate<? super T>[] predicates) { public static <T> Predicate<T> nonePredicate(Predicate<? super T>... predicates) {
return NonePredicate.nonePredicate(predicates); return NonePredicate.nonePredicate(predicates);
} }