mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Guava migration - Remove forwarding overloads
This commit is contained in:
@@ -57,6 +57,7 @@ public class Iterables {
|
||||
|
||||
public static <F, T> Iterable<T> transform(final Iterable<F> iterable, final Function<? super F, T> function) {
|
||||
//TODO: Collection input variant. Some usages use Lists.newArrayList on output which could be made part of the stream.
|
||||
//Should probably also be ? extends T in the function type
|
||||
return () -> StreamSupport.stream(iterable.spliterator(), false).map(function).iterator();
|
||||
}
|
||||
|
||||
@@ -173,36 +174,4 @@ public class Iterables {
|
||||
public static boolean isEmpty(Iterable<?> iterable) {
|
||||
return com.google.common.collect.Iterables.isEmpty(iterable);
|
||||
}
|
||||
|
||||
|
||||
//TODO: Delete everything below.
|
||||
public static <T> Iterable<T> filter(Iterable<T> iterable, com.google.common.base.Predicate<? super T> filter) {
|
||||
return com.google.common.collect.Iterables.filter(iterable, filter);
|
||||
}
|
||||
public static <T> boolean any(Iterable<T> iterable, com.google.common.base.Predicate<? super T> filter) {
|
||||
return com.google.common.collect.Iterables.any(iterable, filter);
|
||||
}
|
||||
public static <T> boolean all(Iterable<T> iterable, com.google.common.base.Predicate<? super T> filter) {
|
||||
return com.google.common.collect.Iterables.any(iterable, filter);
|
||||
}
|
||||
public static <T> boolean removeIf(Iterable<T> iterable, com.google.common.base.Predicate<? super T> test) {
|
||||
return com.google.common.collect.Iterables.removeIf(iterable, test);
|
||||
}
|
||||
public static <T> T find(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate) {
|
||||
return com.google.common.collect.Iterables.find(iterable, predicate);
|
||||
}
|
||||
public static <T> T find(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate, T defaultValue) {
|
||||
return com.google.common.collect.Iterables.find(iterable, predicate, defaultValue);
|
||||
}
|
||||
public static <T> com.google.common.base.Optional<T> tryFind(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate) {
|
||||
return com.google.common.collect.Iterables.tryFind(iterable, predicate);
|
||||
}
|
||||
|
||||
public static <T> int indexOf(Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate) {
|
||||
return com.google.common.collect.Iterables.indexOf(iterable, predicate);
|
||||
}
|
||||
|
||||
public static <F, T> Iterable<T> transform(Iterable<F> iterable, com.google.common.base.Function<? super F, ? extends T> function) {
|
||||
return com.google.common.collect.Iterables.transform(iterable, function);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,56 +60,14 @@ public class Predicates {
|
||||
//TODO: Uncomment all when switching off Guava. Then Inline.
|
||||
|
||||
//TODO: This one probably needs case by case; nullable targets need a safe test, whereas nonnull targets can be simplified further.
|
||||
// public static <T> Predicate<T> equalTo(T target) {
|
||||
// return x -> Objects.equals(target, x);
|
||||
// }
|
||||
|
||||
// public static <T> Predicate<T> instanceOf(Class<?> clazz) {
|
||||
// return clazz::isInstance;
|
||||
// }
|
||||
// public static <T> Predicate<T> in(Collection<? extends T> target) {
|
||||
// return target::contains;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//TODO: Delete everything below.
|
||||
public static <T> com.google.common.base.Predicate<T> not(com.google.common.base.Predicate<T> predicate) {
|
||||
return com.google.common.base.Predicates.not(predicate);
|
||||
public static <T> Predicate<T> equalTo(T target) {
|
||||
return x -> Objects.equals(target, x);
|
||||
}
|
||||
|
||||
public static <T> com.google.common.base.Predicate<T> and(Iterable<? extends com.google.common.base.Predicate<? super T>> components) {
|
||||
return com.google.common.base.Predicates.and(components);
|
||||
public static <T> Predicate<T> instanceOf(Class<?> clazz) {
|
||||
return clazz::isInstance;
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> and(com.google.common.base.Predicate<? super T>... components) {
|
||||
return com.google.common.base.Predicates.and(components);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> and(com.google.common.base.Predicate<? super T> first, com.google.common.base.Predicate<? super T> second) {
|
||||
return com.google.common.base.Predicates.and(first, second);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> or(Iterable<? extends com.google.common.base.Predicate<? super T>> components) {
|
||||
return com.google.common.base.Predicates.or(components);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> or(com.google.common.base.Predicate<? super T>... components) {
|
||||
return com.google.common.base.Predicates.or(components);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> or(com.google.common.base.Predicate<? super T> first, com.google.common.base.Predicate<? super T> second) {
|
||||
return com.google.common.base.Predicates.or(first, second);
|
||||
}
|
||||
|
||||
public static <T> com.google.common.base.Predicate<T> equalTo(T target) {
|
||||
return com.google.common.base.Predicates.equalTo(target);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> instanceOf(Class<?> clazz) {
|
||||
return com.google.common.base.Predicates.instanceOf(clazz);
|
||||
}
|
||||
public static <T> com.google.common.base.Predicate<T> in(Collection<? extends T> target) {
|
||||
return com.google.common.base.Predicates.in(target);
|
||||
}
|
||||
|
||||
public static <A, B> com.google.common.base.Predicate<A> compose(
|
||||
com.google.common.base.Predicate<B> predicate,
|
||||
com.google.common.base.Function<A, ? extends B> function) {
|
||||
return com.google.common.base.Predicates.compose(predicate, function);
|
||||
public static <T> Predicate<T> in(Collection<? extends T> target) {
|
||||
return target::contains;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user