// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }
// 
// Path: miniguava-collect/src/main/java/net/ypresto/miniguava/collect/InternalPredicates.java
// public static <T> Predicate<T> in(Collection<? extends T> target) {
//   return new InPredicate<T>(target);
// }
// 
// Path: miniguava-collect/src/main/java/net/ypresto/miniguava/collect/InternalUtils.java
// @MiniGuavaSpecific(value = MiniGuavaSpecific.Reason.COPIED, from = "CollectPreconditions")
// static void checkRemove(boolean canRemove) {
//   checkState(canRemove, "no calls to next() since the last call to remove()");
// }
// 
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Function.java
// public interface Function<F, T> {
//   /**
//    * Returns the result of applying this function to {@code input}. This method is <i>generally
//    * expected</i>, but not absolutely required, to have the following properties:
//    *
//    * <ul>
//    * <li>Its execution does not cause any observable side effects.
//    * <li>The computation is <i>consistent with equals</i>; that is, {@link Objects#equal
//    *     Objects.equal}{@code (a, b)} implies that {@code Objects.equal(function.apply(a),
//    *     function.apply(b))}.
//    * </ul>
//    *
//    * @throws NullPointerException if {@code input} is null and this function does not accept null
//    *     arguments
//    */
//   @Nullable
//   T apply(@Nullable F input);
// 
//   /**
//    * Indicates whether another object is equal to this function.
//    *
//    * <p>Most implementations will have no reason to override the behavior of {@link Object#equals}.
//    * However, an implementation may also choose to return {@code true} whenever {@code object} is a
//    * {@link Function} that it considers <i>interchangeable</i> with this one. "Interchangeable"
//    * <i>typically</i> means that {@code Objects.equal(this.apply(f), that.apply(f))} is true for all
//    * {@code f} of type {@code F}. Note that a {@code false} result from this method does not imply
//    * that the functions are known <i>not</i> to be interchangeable.
//    */
//   @Override
//   boolean equals(@Nullable Object object);
// }
// 
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Predicate.java
// public interface Predicate<T> {
//   /**
//    * Returns the result of applying this predicate to {@code input}. This method is <i>generally
//    * expected</i>, but not absolutely required, to have the following properties:
//    *
//    * <ul>
//    * <li>Its execution does not cause any observable side effects.
//    * <li>The computation is <i>consistent with equals</i>; that is, {@link Objects#equal
//    *     Objects.equal}{@code (a, b)} implies that {@code predicate.apply(a) ==
//    *     predicate.apply(b))}.
//    * </ul>
//    *
//    * @throws NullPointerException if {@code input} is null and this predicate does not accept null
//    *     arguments
//    */
//   boolean apply(@Nullable T input);
// 
//   /**
//    * Indicates whether another object is equal to this predicate.
//    *
//    * <p>Most implementations will have no reason to override the behavior of {@link Object#equals}.
//    * However, an implementation may also choose to return {@code true} whenever {@code object} is a
//    * {@link Predicate} that it considers <i>interchangeable</i> with this one. "Interchangeable"
//    * <i>typically</i> means that {@code this.apply(t) == that.apply(t)} for all {@code t} of type
//    * {@code T}). Note that a {@code false} result from this method does not imply that the
//    * predicates are known <i>not</i> to be interchangeable.
//    */
//   @Override
//   boolean equals(@Nullable Object object);
// }


import javax.annotation.CheckReturnValue;
import static net.ypresto.miniguava.base.Preconditions.checkNotNull;
import static net.ypresto.miniguava.collect.InternalPredicates.in;
import static net.ypresto.miniguava.collect.InternalUtils.checkRemove;
import net.ypresto.miniguava.annotations.MiniGuavaSpecific;
import net.ypresto.miniguava.annotations.VisibleForTesting;
import net.ypresto.miniguava.base.Function;
import net.ypresto.miniguava.base.Predicate;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
   * @param predicate a predicate that determines whether an element should
   *     be removed
   * @return {@code true} if any elements were removed from the iterator
   * @since 2.0
   */
  // miniguava: reduced visibility from public.
  @VisibleForTesting // miniguava
  static <T> boolean removeIf(Iterator<T> removeFrom, Predicate<? super T> predicate) {
    checkNotNull(predicate);
    boolean modified = false;
    while (removeFrom.hasNext()) {
      if (predicate.apply(removeFrom.next())) {
        removeFrom.remove();
        modified = true;
      }
    }
    return modified;
  }

  /**
   * Adds all elements in {@code iterator} to {@code collection}. The iterator
   * will be left exhausted: its {@code hasNext()} method will return
   * {@code false}.
   *
   * @return {@code true} if {@code collection} was modified as a result of this
   *         operation
   */
  // miniguava: Reduced visibility from public.
  static <T> boolean addAll(Collection<T> addTo, Iterator<? extends T> iterator) {
    checkNotNull(addTo);
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }
// 
// Path: miniguava-collect/src/main/java/net/ypresto/miniguava/collect/InternalPredicates.java
// public static <T> Predicate<T> in(Collection<? extends T> target) {
//   return new InPredicate<T>(target);
// }
// 
// Path: miniguava-collect/src/main/java/net/ypresto/miniguava/collect/InternalUtils.java
// @MiniGuavaSpecific(value = MiniGuavaSpecific.Reason.COPIED, from = "CollectPreconditions")
// static void checkRemove(boolean canRemove) {
//   checkState(canRemove, "no calls to next() since the last call to remove()");
// }
// 
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Function.java
// public interface Function<F, T> {
//   /**
//    * Returns the result of applying this function to {@code input}. This method is <i>generally
//    * expected</i>, but not absolutely required, to have the following properties:
//    *
//    * <ul>
//    * <li>Its execution does not cause any observable side effects.
//    * <li>The computation is <i>consistent with equals</i>; that is, {@link Objects#equal
//    *     Objects.equal}{@code (a, b)} implies that {@code Objects.equal(function.apply(a),
//    *     function.apply(b))}.
//    * </ul>
//    *
//    * @throws NullPointerException if {@code input} is null and this function does not accept null
//    *     arguments
//    */
//   @Nullable
//   T apply(@Nullable F input);
// 
//   /**
//    * Indicates whether another object is equal to this function.
//    *
//    * <p>Most implementations will have no reason to override the behavior of {@link Object#equals}.
//    * However, an implementation may also choose to return {@code true} whenever {@code object} is a
//    * {@link Function} that it considers <i>interchangeable</i> with this one. "Interchangeable"
//    * <i>typically</i> means that {@code Objects.equal(this.apply(f), that.apply(f))} is true for all
//    * {@code f} of type {@code F}. Note that a {@code false} result from this method does not imply
//    * that the functions are known <i>not</i> to be interchangeable.
//    */
//   @Override
//   boolean equals(@Nullable Object object);
// }
// 
// Path: miniguava-base/src/main/java/net/ypresto/miniguava/base/Predicate.java
// public interface Predicate<T> {
//   /**
//    * Returns the result of applying this predicate to {@code input}. This method is <i>generally
//    * expected</i>, but not absolutely required, to have the following properties:
//    *
//    * <ul>
//    * <li>Its execution does not cause any observable side effects.
//    * <li>The computation is <i>consistent with equals</i>; that is, {@link Objects#equal
//    *     Objects.equal}{@code (a, b)} implies that {@code predicate.apply(a) ==
//    *     predicate.apply(b))}.
//    * </ul>
//    *
//    * @throws NullPointerException if {@code input} is null and this predicate does not accept null
//    *     arguments
//    */
//   boolean apply(@Nullable T input);
// 
//   /**
//    * Indicates whether another object is equal to this predicate.
//    *
//    * <p>Most implementations will have no reason to override the behavior of {@link Object#equals}.
//    * However, an implementation may also choose to return {@code true} whenever {@code object} is a
//    * {@link Predicate} that it considers <i>interchangeable</i> with this one. "Interchangeable"
//    * <i>typically</i> means that {@code this.apply(t) == that.apply(t)} for all {@code t} of type
//    * {@code T}). Note that a {@code false} result from this method does not imply that the
//    * predicates are known <i>not</i> to be interchangeable.
//    */
//   @Override
//   boolean equals(@Nullable Object object);
// }


// Path: miniguava-collect/src/main/java/net/ypresto/miniguava/collect/Iterators.java
import javax.annotation.CheckReturnValue;
import static net.ypresto.miniguava.base.Preconditions.checkNotNull;
import static net.ypresto.miniguava.collect.InternalPredicates.in;
import static net.ypresto.miniguava.collect.InternalUtils.checkRemove;
import net.ypresto.miniguava.annotations.MiniGuavaSpecific;
import net.ypresto.miniguava.annotations.VisibleForTesting;
import net.ypresto.miniguava.base.Function;
import net.ypresto.miniguava.base.Predicate;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;

   * @param predicate a predicate that determines whether an element should
   *     be removed
   * @return {@code true} if any elements were removed from the iterator
   * @since 2.0
   */
  // miniguava: reduced visibility from public.
  @VisibleForTesting // miniguava
  static <T> boolean removeIf(Iterator<T> removeFrom, Predicate<? super T> predicate) {
    checkNotNull(predicate);
    boolean modified = false;
    while (removeFrom.hasNext()) {
      if (predicate.apply(removeFrom.next())) {
        removeFrom.remove();
        modified = true;
      }
    }
    return modified;
  }

  /**
   * Adds all elements in {@code iterator} to {@code collection}. The iterator
   * will be left exhausted: its {@code hasNext()} method will return
   * {@code false}.
   *
   * @return {@code true} if {@code collection} was modified as a result of this
   *         operation
   */
  // miniguava: Reduced visibility from public.
  static <T> boolean addAll(Collection<T> addTo, Iterator<? extends T> iterator) {
    checkNotNull(addTo);
    checkNotNull(iterator);