Beispiel #1
0
 /** @see Iterate#tranformIf(Iterable, Predicate, Function, Collection) */
 public static <T, V, R extends Collection<V>> R tranformIf(
     Iterable<T> iterable,
     Predicate<? super T> predicate,
     Function<? super T, ? extends V> function,
     R targetCollection) {
   return IteratorIterate.transformIf(iterable.iterator(), predicate, function, targetCollection);
 }
Beispiel #2
0
 /** @see Iterate#foldLeftWith(Object, Iterable, Function3, Object) */
 public static <T, IV, P> IV foldLeftWith(
     IV injectValue,
     Iterable<T> iterable,
     Function3<? super IV, ? super T, ? super P, ? extends IV> function,
     P parameter) {
   return IteratorIterate.foldLeftWith(injectValue, iterable.iterator(), function, parameter);
 }
Beispiel #3
0
 /** @see Iterate#filterNotWith(Iterable, Predicate2, Object, Collection) */
 public static <T, P, R extends Collection<T>> R filterNotWith(
     Iterable<T> iterable,
     Predicate2<? super T, ? super P> predicate,
     P parameter,
     R targetCollection) {
   return IteratorIterate.filterNotWith(
       iterable.iterator(), predicate, parameter, targetCollection);
 }
Beispiel #4
0
 /** @see Iterate#transformWith(Iterable, Function2, Object, Collection) */
 public static <T, P, A, R extends Collection<A>> R transformWith(
     Iterable<T> iterable,
     Function2<? super T, ? super P, ? extends A> function,
     P parameter,
     R targetCollection) {
   return IteratorIterate.transformWith(
       iterable.iterator(), function, parameter, targetCollection);
 }
Beispiel #5
0
 /** @see Iterate#filterWith(Iterable, Predicate2, Object, Collection) */
 public static <T, P, R extends Collection<T>> R filterWith(
     Iterable<T> iterable,
     Predicate2<? super T, ? super P> predicate,
     P injectedValue,
     R targetCollection) {
   return IteratorIterate.filterWith(
       iterable.iterator(), predicate, injectedValue, targetCollection);
 }
Beispiel #6
0
  public static <T> void forEachWithIndex(
      List<T> iterable, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure) {
    if (from < 0 || to < 0) {
      throw new IllegalArgumentException("Neither from nor to may be negative.");
    }

    Iterator<T> iterator = IteratorIterate.advanceIteratorTo(iterable.iterator(), from);
    int i = from;
    while (iterator.hasNext() && i <= to) {
      objectIntProcedure.value(iterator.next(), i++);
    }
  }
Beispiel #7
0
 /** @see Iterate#zipWithIndex(Iterable, Collection) */
 public static <T, R extends Collection<Pair<T, Integer>>> R zipWithIndex(
     Iterable<T> iterable, R target) {
   return IteratorIterate.zipWithIndex(iterable.iterator(), target);
 }
Beispiel #8
0
 /** @see Iterate#groupByEach(Iterable, Function, MutableMultimap) */
 public static <T, V, R extends MutableMultimap<V, T>> R groupByEach(
     Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function, R target) {
   return IteratorIterate.groupByEach(iterable.iterator(), function, target);
 }
Beispiel #9
0
 /** @see Iterate#zip(Iterable, Iterable, Collection) */
 public static <X, Y, R extends Collection<Pair<X, Y>>> R zip(
     Iterable<X> xs, Iterable<Y> ys, R target) {
   return IteratorIterate.zip(xs.iterator(), ys.iterator(), target);
 }
Beispiel #10
0
 /** @see Iterate#forEachWith(Iterable, Procedure2, Object) */
 public static <T, P> void forEachWith(
     Iterable<T> iterable, Procedure2<? super T, ? super P> procedure, P parameter) {
   IteratorIterate.forEachWith(iterable.iterator(), procedure, parameter);
 }
Beispiel #11
0
 /** @see Iterate#filterNot(Iterable, Predicate, Collection) */
 public static <T, R extends Collection<T>> R filterNot(
     Iterable<T> iterable, Predicate<? super T> predicate, R targetCollection) {
   return IteratorIterate.filterNot(iterable.iterator(), predicate, targetCollection);
 }
Beispiel #12
0
 /** @see Iterate#max(Iterable) */
 public static <T> T max(Iterable<T> iterable) {
   return IteratorIterate.max(iterable.iterator(), Comparators.naturalOrder());
 }
Beispiel #13
0
 /** @see Iterate#foldLeft(Object, Iterable, Function2) */
 public static <T, IV> IV foldLeft(
     IV injectValue,
     Iterable<T> iterable,
     Function2<? super IV, ? super T, ? extends IV> function) {
   return IteratorIterate.foldLeft(injectValue, iterable.iterator(), function);
 }
Beispiel #14
0
 /** @see Iterate#partitionWith(Iterable, Predicate2, Object) */
 public static <T, IV> Twin<MutableList<T>> partitionWith(
     Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) {
   return IteratorIterate.partitionWith(iterable.iterator(), predicate, injectedValue);
 }
Beispiel #15
0
 /** @see Iterate#count(Iterable, Predicate) */
 public static <T> int count(Iterable<T> iterable, Predicate<? super T> predicate) {
   return IteratorIterate.count(iterable.iterator(), predicate);
 }
Beispiel #16
0
 /** @see Iterate#forEach(Iterable, Procedure) */
 public static <T> void forEach(Iterable<T> iterable, Procedure<? super T> procedure) {
   IteratorIterate.forEach(iterable.iterator(), procedure);
 }
Beispiel #17
0
 /** @see Iterate#allSatisfy(Iterable, Predicate) */
 public static <T> boolean allSatisfy(Iterable<T> iterable, Predicate<? super T> predicate) {
   return IteratorIterate.allSatisfy(iterable.iterator(), predicate);
 }
Beispiel #18
0
 /** @see Iterate#foldLeft(double, Iterable, DoubleObjectToDoubleFunction) */
 public static <T> double foldLeft(
     double injectValue, Iterable<T> iterable, DoubleObjectToDoubleFunction<? super T> function) {
   return IteratorIterate.foldLeft(injectValue, iterable.iterator(), function);
 }
Beispiel #19
0
 /** @see Iterate#foldLeft(long, Iterable, LongObjectToLongFunction) */
 public static <T> long foldLeft(
     long injectValue, Iterable<T> iterable, LongObjectToLongFunction<? super T> function) {
   return IteratorIterate.foldLeft(injectValue, iterable.iterator(), function);
 }
Beispiel #20
0
 /** @see Iterate#foldLeft(int, Iterable, IntObjectToIntFunction) */
 public static <T> int foldLeft(
     int injectValue, Iterable<T> iterable, IntObjectToIntFunction<? super T> function) {
   return IteratorIterate.foldLeft(injectValue, iterable.iterator(), function);
 }
Beispiel #21
0
 /** @see Iterate#chunk(Iterable, int) */
 public static <T> RichIterable<RichIterable<T>> chunk(Iterable<T> iterable, int size) {
   return IteratorIterate.chunk(iterable.iterator(), size);
 }
Beispiel #22
0
 /** @see Iterate#flatTransform(Iterable, Function, Collection) */
 public static <T, V, R extends Collection<V>> R flatTransform(
     Iterable<T> iterable,
     Function<? super T, ? extends Iterable<V>> function,
     R targetCollection) {
   return IteratorIterate.flatTransform(iterable.iterator(), function, targetCollection);
 }
Beispiel #23
0
 /** @see Iterate#max(Iterable, Comparator) */
 public static <T> T max(Iterable<T> iterable, Comparator<? super T> comparator) {
   return IteratorIterate.max(iterable.iterator(), comparator);
 }
Beispiel #24
0
 /** @see Iterate#findIndex(Iterable, Predicate) */
 public static <T> int findIndex(Iterable<T> iterable, Predicate<? super T> predicate) {
   return IteratorIterate.findIndex(iterable.iterator(), predicate);
 }
Beispiel #25
0
 /** @see Iterate#allSatisfyWith(Iterable, Predicate2, Object) */
 public static <T, IV> boolean allSatisfyWith(
     Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) {
   return IteratorIterate.allSatisfyWith(iterable.iterator(), predicate, injectedValue);
 }
Beispiel #26
0
 /** @see Iterate#forEachWithIndex(Iterable, ObjectIntProcedure) */
 public static <T> void forEachWithIndex(
     Iterable<T> iterable, ObjectIntProcedure<? super T> objectIntProcedure) {
   IteratorIterate.forEachWithIndex(iterable.iterator(), objectIntProcedure);
 }
Beispiel #27
0
 /** @see Iterate#partition(Iterable, Predicate) */
 public static <T> PartitionMutableList<T> partition(
     Iterable<T> iterable, Predicate<? super T> predicate) {
   return IteratorIterate.partition(iterable.iterator(), predicate);
 }
Beispiel #28
0
 /** @see Iterate#removeIfWith(Iterable, Predicate2, Object) */
 public static <T, P> Iterable<T> removeIfWith(
     Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter) {
   IteratorIterate.removeIfWith(iterable.iterator(), predicate, parameter);
   return iterable;
 }
Beispiel #29
0
 /** @see Iterate#countWith(Iterable, Predicate2, Object) */
 public static <T, IV> int countWith(
     Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) {
   return IteratorIterate.countWith(iterable.iterator(), predicate, injectedValue);
 }
Beispiel #30
0
 public static <T> Iterable<T> removeIf(
     Iterable<T> iterable, Predicate<? super T> predicate, Procedure<? super T> procedure) {
   IteratorIterate.removeIf(iterable.iterator(), predicate, procedure);
   return iterable;
 }