From 2f4d235479eabab92cddba408b56d6abf943ad2c Mon Sep 17 00:00:00 2001 From: Joerg Schaible Date: Tue, 3 Jul 2012 21:25:08 +0000 Subject: [PATCH] More var-args. Clean-up. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1356957 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections/PredicateUtils.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/commons/collections/PredicateUtils.java b/src/main/java/org/apache/commons/collections/PredicateUtils.java index 8753b57d7..ffa6b4280 100644 --- a/src/main/java/org/apache/commons/collections/PredicateUtils.java +++ b/src/main/java/org/apache/commons/collections/PredicateUtils.java @@ -67,10 +67,7 @@ import org.apache.commons.collections.functors.UniquePredicate; * All the supplied predicates are Serializable. * * @since Commons Collections 3.0 - * @version $Revision$ - * - * @author Stephen Colebourne - * @author Ola Berg + * @version $Id$ */ public class PredicateUtils { @@ -284,7 +281,7 @@ public class PredicateUtils { * @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead. */ @Deprecated - public static Predicate allPredicate(Predicate[] predicates) { + public static Predicate allPredicate(Predicate... predicates) { return AllPredicate.allPredicate(predicates); } @@ -331,7 +328,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if any predicate in the array is null */ - public static Predicate anyPredicate(Predicate[] predicates) { + public static Predicate anyPredicate(Predicate... predicates) { return AnyPredicate.anyPredicate(predicates); } @@ -362,9 +359,10 @@ public class PredicateUtils { * @return the either predicate * @throws IllegalArgumentException if either predicate is null */ - @SuppressWarnings("unchecked") public static Predicate eitherPredicate(Predicate predicate1, Predicate predicate2) { - return onePredicate(new Predicate[] { predicate1, predicate2 }); + @SuppressWarnings("unchecked") + Predicate onePredicate = onePredicate(predicate1, predicate2); + return onePredicate; } /** @@ -379,7 +377,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if any predicate in the array is null */ - public static Predicate onePredicate(Predicate[] predicates) { + public static Predicate onePredicate(Predicate... predicates) { return OnePredicate.onePredicate(predicates); } @@ -410,9 +408,10 @@ public class PredicateUtils { * @return the neither predicate * @throws IllegalArgumentException if either predicate is null */ - @SuppressWarnings("unchecked") public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { - return nonePredicate(new Predicate[] { predicate1, predicate2 }); + @SuppressWarnings("unchecked") + Predicate nonePredicate = nonePredicate(predicate1, predicate2); + return nonePredicate; } /** @@ -427,7 +426,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if any predicate in the array is null */ - public static Predicate nonePredicate(Predicate[] predicates) { + public static Predicate nonePredicate(Predicate... predicates) { return NonePredicate.nonePredicate(predicates); }