Migrate toward java.util.function
- Package-private changes only - Maintains binary and source compatibility
This commit is contained in:
parent
68c0814f23
commit
ee307055b7
|
@ -51,7 +51,7 @@ public abstract class AbstractQuantifierPredicate<T> extends AbstractPredicate<T
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Predicate<? super T>[] getPredicates() {
|
public Predicate<? super T>[] getPredicates() {
|
||||||
return FunctorUtils.<T>copy(iPredicates);
|
return FunctorUtils.copy(iPredicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,8 @@ public final class AllPredicate<T> extends AbstractQuantifierPredicate<T> {
|
||||||
if (predicates.length == 1) {
|
if (predicates.length == 1) {
|
||||||
return coerce(predicates[0]);
|
return coerce(predicates[0]);
|
||||||
}
|
}
|
||||||
|
// <T> not needed in Eclipse but needed by the command line compiler
|
||||||
return new AllPredicate<>(FunctorUtils.copy(predicates));
|
return new AllPredicate<T>(FunctorUtils.copy(predicates));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -82,7 +82,7 @@ public final class AnyPredicate<T> extends AbstractQuantifierPredicate<T> {
|
||||||
if (predicates.length == 1) {
|
if (predicates.length == 1) {
|
||||||
return (Predicate<T>) predicates[0];
|
return (Predicate<T>) predicates[0];
|
||||||
}
|
}
|
||||||
return new AnyPredicate<>(FunctorUtils.copy(predicates));
|
return new AnyPredicate<T>(FunctorUtils.copy(predicates));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,7 +87,7 @@ final class FunctorUtils {
|
||||||
* @return the cloned consumers.
|
* @return the cloned consumers.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static <C extends Consumer<?>> C[] copy(final C... consumers) {
|
static <T extends Consumer<?>> T[] copy(final T... consumers) {
|
||||||
if (consumers == null) {
|
if (consumers == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -103,11 +103,11 @@ final class FunctorUtils {
|
||||||
* @return the cloned predicates
|
* @return the cloned predicates
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static <T> Predicate<T>[] copy(final Predicate<? super T>... predicates) {
|
static <T extends java.util.function.Predicate<?>> T[] copy(final T... predicates) {
|
||||||
if (predicates == null) {
|
if (predicates == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (Predicate<T>[]) predicates.clone();
|
return predicates.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,7 +72,8 @@ public final class NonePredicate<T> extends AbstractQuantifierPredicate<T> {
|
||||||
if (predicates.length == 0) {
|
if (predicates.length == 0) {
|
||||||
return TruePredicate.<T>truePredicate();
|
return TruePredicate.<T>truePredicate();
|
||||||
}
|
}
|
||||||
return new NonePredicate<>(FunctorUtils.copy(predicates));
|
// <T> not needed in Eclipse but needed by the command line compiler
|
||||||
|
return new NonePredicate<T>(FunctorUtils.copy(predicates));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,7 +72,8 @@ public final class OnePredicate<T> extends AbstractQuantifierPredicate<T> {
|
||||||
if (predicates.length == 1) {
|
if (predicates.length == 1) {
|
||||||
return (Predicate<T>) predicates[0];
|
return (Predicate<T>) predicates[0];
|
||||||
}
|
}
|
||||||
return new OnePredicate<>(FunctorUtils.copy(predicates));
|
// <T> not needed in Eclipse but needed by the command line compiler
|
||||||
|
return new OnePredicate<T>(FunctorUtils.copy(predicates));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
public Predicate<? super E>[] getPredicates() {
|
public Predicate<? super E>[] getPredicates() {
|
||||||
return FunctorUtils.<E>copy(iPredicates);
|
return FunctorUtils.copy(iPredicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
public Predicate<? super I>[] getPredicates() {
|
public Predicate<? super I>[] getPredicates() {
|
||||||
return FunctorUtils.<I>copy(iPredicates);
|
return FunctorUtils.copy(iPredicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue