diff --git a/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java b/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java index 063ac253c..ec43ee897 100644 --- a/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java +++ b/src/main/java/org/apache/commons/collections/functors/ChainedClosure.java @@ -50,8 +50,7 @@ public class ChainedClosure implements Closure, Serializable { if (closures.length == 0) { return NOPClosure.nopClosure(); } - closures = FunctorUtils.copy(closures); - return new ChainedClosure(closures); + return new ChainedClosure(FunctorUtils.copy(closures)); } /** diff --git a/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java b/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java index 541ef41b9..40e111909 100644 --- a/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java +++ b/src/main/java/org/apache/commons/collections/functors/ChainedTransformer.java @@ -53,8 +53,7 @@ public class ChainedTransformer implements Transformer, Serializable { if (transformers.length == 0) { return NOPTransformer.nopTransformer(); } - transformers = FunctorUtils.copy(transformers); - return new ChainedTransformer(transformers); + return new ChainedTransformer(FunctorUtils.copy(transformers)); } /** diff --git a/src/main/java/org/apache/commons/collections/functors/NonePredicate.java b/src/main/java/org/apache/commons/collections/functors/NonePredicate.java index b240ebab4..d2065bbd9 100644 --- a/src/main/java/org/apache/commons/collections/functors/NonePredicate.java +++ b/src/main/java/org/apache/commons/collections/functors/NonePredicate.java @@ -58,8 +58,7 @@ public final class NonePredicate implements Predicate, PredicateDecorator< if (predicates.length == 0) { return TruePredicate.truePredicate(); } - predicates = FunctorUtils.copy(predicates); - return new NonePredicate(predicates); + return new NonePredicate(FunctorUtils.copy(predicates)); } /** diff --git a/src/main/java/org/apache/commons/collections/functors/OnePredicate.java b/src/main/java/org/apache/commons/collections/functors/OnePredicate.java index 28d90b9b7..5c5645405 100644 --- a/src/main/java/org/apache/commons/collections/functors/OnePredicate.java +++ b/src/main/java/org/apache/commons/collections/functors/OnePredicate.java @@ -63,8 +63,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator) predicates[0]; } - predicates = FunctorUtils.copy(predicates); - return new OnePredicate(predicates); + return new OnePredicate(FunctorUtils.copy(predicates)); } /** diff --git a/src/main/java/org/apache/commons/collections/functors/SwitchClosure.java b/src/main/java/org/apache/commons/collections/functors/SwitchClosure.java index f01f67cd6..6b7d6df18 100644 --- a/src/main/java/org/apache/commons/collections/functors/SwitchClosure.java +++ b/src/main/java/org/apache/commons/collections/functors/SwitchClosure.java @@ -63,9 +63,7 @@ public class SwitchClosure implements Closure, Serializable { if (predicates.length == 0) { return (Closure) (defaultClosure == null ? NOPClosure.nopClosure(): defaultClosure); } - predicates = FunctorUtils.copy(predicates); - closures = FunctorUtils.copy(closures); - return new SwitchClosure(predicates, closures, defaultClosure); + return new SwitchClosure(FunctorUtils.copy(predicates), FunctorUtils.copy(closures), defaultClosure); } /** diff --git a/src/main/java/org/apache/commons/collections/functors/SwitchTransformer.java b/src/main/java/org/apache/commons/collections/functors/SwitchTransformer.java index e4548e868..37031f672 100644 --- a/src/main/java/org/apache/commons/collections/functors/SwitchTransformer.java +++ b/src/main/java/org/apache/commons/collections/functors/SwitchTransformer.java @@ -65,9 +65,9 @@ public class SwitchTransformer implements Transformer, Serializable if (predicates.length == 0) { return (Transformer) (defaultTransformer == null ? ConstantTransformer.nullTransformer() : defaultTransformer); } - predicates = FunctorUtils.copy(predicates); - transformers = FunctorUtils.copy(transformers); - return new SwitchTransformer(predicates, transformers, defaultTransformer); + return new SwitchTransformer(FunctorUtils.copy(predicates), + FunctorUtils.copy(transformers), + defaultTransformer); } /**