fix gradle compile errors

This commit is contained in:
Sen 2025-05-30 13:00:33 +02:00
parent 18be47866c
commit c8e5c16e41
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
4 changed files with 3 additions and 359 deletions

View file

@ -62,7 +62,7 @@ public class Block {
}
public Iterator<T[]> iterator() {
return (Iterator<T[]>)(this.iterables.length <= 0 ? Collections.singletonList((Object[])createArray(this.clazz, 0)).iterator()
return (Iterator<T[]>)(this.iterables.length <= 0 ? Collections.singletonList((T[])createArray(this.clazz, 0)).iterator()
: new Product.ProductIterator(this.clazz, this.iterables));
}

View file

@ -183,12 +183,12 @@ public final class Filter {
@Override
public boolean removeAll(final Collection<?> collection) {
return Iterables.removeIf(unfiltered, and(predicate, in(collection)));
return Iterables.removeIf(unfiltered, and(predicate, in((Collection<E>)collection)));
}
@Override
public boolean retainAll(final Collection<?> collection) {
return Iterables.removeIf(unfiltered, and(predicate, not(in(collection))));
return Iterables.removeIf(unfiltered, and(predicate, not(in((Collection<E>)collection))));
}
@Override

View file

@ -45,104 +45,6 @@ import java.util.function.Predicate;
public final class Iterables {
private Iterables() {}
/** Returns an unmodifiable view of {@code iterable}. */
// public static <T> Iterable<T> unmodifiableIterable(
// final Iterable<T> iterable) {
// checkNotNull(iterable);
// if (iterable instanceof UnmodifiableIterable ||
// iterable instanceof ImmutableCollection) {
// return iterable;
// }
// return new UnmodifiableIterable<T>(iterable);
// }
/**
* Simply returns its argument.
*
* @deprecated no need to use this
* @since 10.0
*/
// @Deprecated public static <E> Iterable<E> unmodifiableIterable(
// ImmutableCollection<E> iterable) {
// return checkNotNull(iterable);
// }
// private static final class UnmodifiableIterable<T> extends FluentIterable<T> {
// private final Iterable<T> iterable;
//
// private UnmodifiableIterable(Iterable<T> iterable) {
// this.iterable = iterable;
// }
//
// @Override
// public Iterator<T> iterator() {
// return Iterators.unmodifiableIterator(iterable.iterator());
// }
//
// @Override
// public String toString() {
// return iterable.toString();
// }
// // no equals and hashCode; it would break the contract!
// }
/**
* Returns the number of elements in {@code iterable}.
*/
// public static int size(Iterable<?> iterable) {
// return (iterable instanceof Collection)
// ? ((Collection<?>) iterable).size()
// : Iterators.size(iterable.iterator());
// }
/**
* Returns {@code true} if {@code iterable} contains any object for which {@code equals(element)}
* is true.
*/
// public static boolean contains(Iterable<?> iterable, Object element) {
// if (iterable instanceof Collection) {
// Collection<?> collection = (Collection<?>) iterable;
// return Filter.safeContains(collection, element);
// }
// return Iterators.contains(iterable.iterator(), element);
// }
/**
* Removes, from an iterable, every element that belongs to the provided
* collection.
*
* <p>This method calls {@link Collection#removeAll} if {@code iterable} is a
* collection, and {@link Iterators#removeAll} otherwise.
*
* @param removeFrom the iterable to (potentially) remove elements from
* @param elementsToRemove the elements to remove
* @return {@code true} if any element was removed from {@code iterable}
*/
// public static boolean removeAll(
// Iterable<?> removeFrom, Collection<?> elementsToRemove) {
// return (removeFrom instanceof Collection)
// ? ((Collection<?>) removeFrom).removeAll(checkNotNull(elementsToRemove))
// : Iterators.removeAll(removeFrom.iterator(), elementsToRemove);
// }
/**
* Removes, from an iterable, every element that does not belong to the
* provided collection.
*
* <p>This method calls {@link Collection#retainAll} if {@code iterable} is a
* collection, and {@link Iterators#retainAll} otherwise.
*
* @param removeFrom the iterable to (potentially) remove elements from
* @param elementsToRetain the elements to retain
* @return {@code true} if any element was removed from {@code iterable}
*/
// public static boolean retainAll(
// Iterable<?> removeFrom, Collection<?> elementsToRetain) {
// return (removeFrom instanceof Collection)
// ? ((Collection<?>) removeFrom).retainAll(checkNotNull(elementsToRetain))
// : Iterators.retainAll(removeFrom.iterator(), elementsToRetain);
// }
/**
* Removes, from an iterable, every element that satisfies the provided
* predicate.

View file

@ -148,17 +148,6 @@ public final class Iterators {
};
}
/**
* Simply returns its argument.
*
* @deprecated no need to use this
* @since 10.0
*/
// @Deprecated public static <T> UnmodifiableIterator<T> unmodifiableIterator(
// UnmodifiableIterator<T> iterator) {
// return checkNotNull(iterator);
// }
/**
* Returns the number of elements remaining in {@code iterator}. The iterator
* will be left exhausted: its {@code hasNext()} method will return
@ -1040,253 +1029,6 @@ public final class Iterators {
};
}
/**
* Returns an iterator containing only {@code value}.
*
* <p>The {@link Iterable} equivalent of this method is {@link
* Collections#singleton}.
*/
// public static <T> UnmodifiableIterator<T> singletonIterator(
// final T value) {
// return new UnmodifiableIterator<T>() {
// boolean done;
// @Override
// public boolean hasNext() {
// return !done;
// }
// @Override
// public T next() {
// if (done) {
// throw new NoSuchElementException();
// }
// done = true;
// return value;
// }
// };
// }
/**
* Adapts an {@code Enumeration} to the {@code Iterator} interface.
*
* <p>This method has no equivalent in {@link Iterables} because viewing an
* {@code Enumeration} as an {@code Iterable} is impossible. However, the
* contents can be <i>copied</i> into a collection using {@link
* Collections#list}.
*/
// public static <T> UnmodifiableIterator<T> forEnumeration(
// final Enumeration<T> enumeration) {
// checkNotNull(enumeration);
// return new UnmodifiableIterator<T>() {
// @Override
// public boolean hasNext() {
// return enumeration.hasMoreElements();
// }
// @Override
// public T next() {
// return enumeration.nextElement();
// }
// };
// }
/**
* Adapts an {@code Iterator} to the {@code Enumeration} interface.
*
* <p>The {@code Iterable} equivalent of this method is either {@link
* Collections#enumeration} (if you have a {@link Collection}), or
* {@code Iterators.asEnumeration(collection.iterator())}.
*/
// public static <T> Enumeration<T> asEnumeration(final Iterator<T> iterator) {
// checkNotNull(iterator);
// return new Enumeration<T>() {
// @Override
// public boolean hasMoreElements() {
// return iterator.hasNext();
// }
// @Override
// public T nextElement() {
// return iterator.next();
// }
// };
// }
/**
* Implementation of PeekingIterator that avoids peeking unless necessary.
*/
// private static class PeekingImpl<E> implements PeekingIterator<E> {
//
// private final Iterator<? extends E> iterator;
// private boolean hasPeeked;
// private E peekedElement;
//
// public PeekingImpl(Iterator<? extends E> iterator) {
// this.iterator = checkNotNull(iterator);
// }
//
// @Override
// public boolean hasNext() {
// return hasPeeked || iterator.hasNext();
// }
//
// @Override
// public E next() {
// if (!hasPeeked) {
// return iterator.next();
// }
// E result = peekedElement;
// hasPeeked = false;
// peekedElement = null;
// return result;
// }
//
// @Override
// public void remove() {
// checkState(!hasPeeked, "Can't remove after you've peeked at next");
// iterator.remove();
// }
//
// @Override
// public E peek() {
// if (!hasPeeked) {
// peekedElement = iterator.next();
// hasPeeked = true;
// }
// return peekedElement;
// }
// }
/**
* Returns a {@code PeekingIterator} backed by the given iterator.
*
* <p>Calls to the {@code peek} method with no intervening calls to {@code
* next} do not affect the iteration, and hence return the same object each
* time. A subsequent call to {@code next} is guaranteed to return the same
* object again. For example: <pre> {@code
*
* PeekingIterator<String> peekingIterator =
* Iterators.peekingIterator(Iterators.forArray("a", "b"));
* String a1 = peekingIterator.peek(); // returns "a"
* String a2 = peekingIterator.peek(); // also returns "a"
* String a3 = peekingIterator.next(); // also returns "a"}</pre>
*
* <p>Any structural changes to the underlying iteration (aside from those
* performed by the iterator's own {@link PeekingIterator#remove()} method)
* will leave the iterator in an undefined state.
*
* <p>The returned iterator does not support removal after peeking, as
* explained by {@link PeekingIterator#remove()}.
*
* <p>Note: If the given iterator is already a {@code PeekingIterator},
* it <i>might</i> be returned to the caller, although this is neither
* guaranteed to occur nor required to be consistent. For example, this
* method <i>might</i> choose to pass through recognized implementations of
* {@code PeekingIterator} when the behavior of the implementation is
* known to meet the contract guaranteed by this method.
*
* <p>There is no {@link Iterable} equivalent to this method, so use this
* method to wrap each individual iterator as it is generated.
*
* @param iterator the backing iterator. The {@link PeekingIterator} assumes
* ownership of this iterator, so users should cease making direct calls
* to it after calling this method.
* @return a peeking iterator backed by that iterator. Apart from the
* additional {@link PeekingIterator#peek()} method, this iterator behaves
* exactly the same as {@code iterator}.
*/
// public static <T> PeekingIterator<T> peekingIterator(
// Iterator<? extends T> iterator) {
// if (iterator instanceof PeekingImpl) {
// // Safe to cast <? extends T> to <T> because PeekingImpl only uses T
// // covariantly (and cannot be subclassed to add non-covariant uses).
//
// PeekingImpl<T> peeking = (PeekingImpl<T>) iterator;
// return peeking;
// }
// return new PeekingImpl<T>(iterator);
// }
/**
* Simply returns its argument.
*
* @deprecated no need to use this
* @since 10.0
*/
// @Deprecated public static <T> PeekingIterator<T> peekingIterator(
// PeekingIterator<T> iterator) {
// return checkNotNull(iterator);
// }
/**
* Returns an iterator over the merged contents of all given
* {@code iterators}, traversing every element of the input iterators.
* Equivalent entries will not be de-duplicated.
*
* <p>Callers must ensure that the source {@code iterators} are in
* non-descending order as this method does not sort its input.
*
* <p>For any equivalent elements across all {@code iterators}, it is
* undefined which element is returned first.
*
* @since 11.0
*/
// @Beta
// public static <T> UnmodifiableIterator<T> mergeSorted(
// Iterable<? extends Iterator<? extends T>> iterators,
// Comparator<? super T> comparator) {
// checkNotNull(iterators, "iterators");
// checkNotNull(comparator, "comparator");
//
// return new MergingIterator<T>(iterators, comparator);
// }
/**
* An iterator that performs a lazy N-way merge, calculating the next value
* each time the iterator is polled. This amortizes the sorting cost over the
* iteration and requires less memory than sorting all elements at once.
*
* <p>Retrieving a single element takes approximately O(log(M)) time, where M
* is the number of iterators. (Retrieving all elements takes approximately
* O(N*log(M)) time, where N is the total number of elements.)
*/
// private static class MergingIterator<T> extends UnmodifiableIterator<T> {
// final Queue<PeekingIterator<T>> queue;
//
// public MergingIterator(Iterable<? extends Iterator<? extends T>> iterators,
// final Comparator<? super T> itemComparator) {
// // A comparator that's used by the heap, allowing the heap
// // to be sorted based on the top of each iterator.
// Comparator<PeekingIterator<T>> heapComparator =
// new Comparator<PeekingIterator<T>>() {
// @Override
// public int compare(PeekingIterator<T> o1, PeekingIterator<T> o2) {
// return itemComparator.compare(o1.peek(), o2.peek());
// }
// };
//
// queue = new PriorityQueue<PeekingIterator<T>>(2, heapComparator);
//
// for (Iterator<? extends T> iterator : iterators) {
// if (iterator.hasNext()) {
// queue.add(Iterators.peekingIterator(iterator));
// }
// }
// }
//
// @Override
// public boolean hasNext() {
// return !queue.isEmpty();
// }
//
// @Override
// public T next() {
// PeekingIterator<T> nextIter = queue.remove();
// T next = nextIter.next();
// if (nextIter.hasNext()) {
// queue.add(nextIter);
// }
// return next;
// }
// }
/**
* Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557
*/