You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/07/11 17:50:30 UTC
(commons-collections) 01/10: Migrate toward java.util.function.Predicate
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 68c0814f23a9ee2d3560e453bbc467d88fc9fa3d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 11 09:07:37 2024 -0400
Migrate toward java.util.function.Predicate
- Package-private changes only
- Maintains binary and source compatibility
---
.../apache/commons/collections4/functors/ChainedClosure.java | 2 +-
.../apache/commons/collections4/functors/FunctorUtils.java | 12 ++++++------
.../apache/commons/collections4/functors/SwitchClosure.java | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java b/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java
index 892ec0b26..3eeba857d 100644
--- a/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java
+++ b/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java
@@ -118,7 +118,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
* @since 3.1
*/
public Closure<? super E>[] getClosures() {
- return FunctorUtils.<E>copy(iClosures);
+ return FunctorUtils.copy(iClosures);
}
}
diff --git a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java
index d118dd24d..36687265c 100644
--- a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java
+++ b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java
@@ -81,17 +81,17 @@ final class FunctorUtils {
}
/**
- * Clone the closures to ensure that the internal reference can't be messed with.
+ * Clones the consumers to ensure that the internal references can't be updated.
*
- * @param closures the closures to copy
- * @return the cloned closures
+ * @param consumers the consumers to copy.
+ * @return the cloned consumers.
*/
@SuppressWarnings("unchecked")
- static <E> Closure<E>[] copy(final Closure<? super E>... closures) {
- if (closures == null) {
+ static <C extends Consumer<?>> C[] copy(final C... consumers) {
+ if (consumers == null) {
return null;
}
- return (Closure<E>[]) closures.clone();
+ return consumers.clone();
}
/**
diff --git a/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java b/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java
index 6108b93d1..eda6c36f4 100644
--- a/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java
+++ b/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java
@@ -157,7 +157,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
* @since 3.1
*/
public Closure<? super E>[] getClosures() {
- return FunctorUtils.<E>copy(iClosures);
+ return FunctorUtils.copy(iClosures);
}
/**