public abstract class Reductions extends Object
| Constructor and Description |
|---|
Reductions() |
| Modifier and Type | Method and Description |
|---|---|
static <E> boolean |
any(E[] array,
Predicate<E> predicate)
Yields true if ANY predicate application on the given array yields true
(giving up on the first positive match).
|
static <E> boolean |
any(Iterable<E> iterable,
Predicate<E> predicate)
Yields true if ANY predicate application on the given iterable yields
true (giving up on the first positive match).
|
static <E> boolean |
any(Iterator<E> iterator,
Predicate<E> predicate)
Yields true if ANY predicate application on the given iterator yields
true (giving up on the first positive match).
|
static <E> long |
count(Iterable<E> iterable)
Counts elements contained in the iterable.
|
static <E> long |
count(Iterator<E> iterator)
Counts elements contained in the iterator.
|
static <E> int |
counti(Iterable<E> iterable)
Counts elements contained in the iterable.
|
static <E> int |
counti(Iterator<E> iterator)
Counts elements contained in the iterator.
|
static <E> boolean |
every(E[] array,
Predicate<E> predicate)
Yields true if EVERY predicate application on the given array yields
true.
|
static <E> boolean |
every(Iterable<E> iterable,
Predicate<E> predicate)
Yields true if EVERY predicate application on the given iterable yields
true.
|
static <E> boolean |
every(Iterator<E> iterator,
Predicate<E> predicate)
Yields true if EVERY predicate application on the given iterator yields
true.
|
static <E,C extends Comparator<E>> |
maximum(Iterator<E> iterator,
C comparator,
E init)
Returns the max element contained in the iterator
|
static <E extends Comparable<E>> |
maximum(Iterator<E> iterator,
E init)
Returns the max element contained in the iterator
|
static <E,C extends Comparator<E>> |
minimum(Iterator<E> iterator,
C comparator,
E init)
Returns the min element contained in the iterator
|
static <E extends Comparable<E>> |
minimum(Iterator<E> iterator,
E init)
Returns the min element contained in the iterator
|
static <E,R> R |
reduce(E[] array,
BiFunction<R,E,R> function,
R init)
Reduces an array of elements using the passed function.
|
static <E,R> R |
reduce(Iterable<E> iterable,
BiFunction<R,E,R> function,
R init)
Reduces an iterator of elements using the passed function.
|
static <E,R> R |
reduce(Iterator<E> iterator,
BiFunction<R,E,R> function,
R init)
Reduces an iterator of elements using the passed function.
|
public static <E,R> R reduce(Iterator<E> iterator, BiFunction<R,E,R> function, R init)
E - the element type parameterR - the result type parameteriterator - the iterator to be consumedfunction - the reduction functioninit - the initial value for reductionspublic static <E,R> R reduce(Iterable<E> iterable, BiFunction<R,E,R> function, R init)
E - the element type parameterR - the result type parameteriterable - the iterable to be consumedfunction - the reduction functioninit - the initial value for reductionspublic static <E,R> R reduce(E[] array,
BiFunction<R,E,R> function,
R init)
E - the element type parameterR - the result type parameterarray - the array to be consumedfunction - the reduction functioninit - the initial value for reductionspublic static <E> boolean any(Iterable<E> iterable, Predicate<E> predicate)
E - the iterable element type parameteriterable - the iterable where elements are fetched frompredicate - the predicate applied to every element until a match is
foundpublic static <E> boolean any(Iterator<E> iterator, Predicate<E> predicate)
E - the iterator element type parameteriterator - the iterator where elements are fetched frompredicate - the predicate applied to every element until a match is
foundpublic static <E> boolean any(E[] array,
Predicate<E> predicate)
E - the array element type parameterarray - the array where elements are fetched frompredicate - the predicate applied to every element until a match is
foundpublic static <E> boolean every(Iterable<E> iterable, Predicate<E> predicate)
E - the iterable element type parameteriterable - the iterable where elements are fetched frompredicate - the predicate applied to every element fetched from the
iterablepublic static <E> boolean every(Iterator<E> iterator, Predicate<E> predicate)
E - the iterator element type parameteriterator - the iterator where elements are fetched frompredicate - the predicate applied to every element fetched from the
iteratorpublic static <E> boolean every(E[] array,
Predicate<E> predicate)
E - the array element type parameterarray - the array where elements are fetched frompredicate - the predicate applied to every element fetched from the
arraypublic static <E> long count(Iterator<E> iterator)
E - the iterator element type parameteriterator - the iterator to be consumedpublic static <E> long count(Iterable<E> iterable)
E - the iterable element type parameteriterable - the iterable to be consumedpublic static <E> int counti(Iterator<E> iterator)
E - the iterator element type parameteriterator - the iterator to be consumedpublic static <E> int counti(Iterable<E> iterable)
E - the iterable element type parameteriterable - the iterable to be consumedpublic static <E,C extends Comparator<E>> E maximum(Iterator<E> iterator, C comparator, E init)
E - the iterator element type parameterC - the comparator type parameteriterator - the iterator to be consumedcomparator - the comparator to be used to evaluate the max elementinit - the initial value to be usedpublic static <E extends Comparable<E>> E maximum(Iterator<E> iterator, E init)
E - the iterator element type parameteriterator - the iterator to be consumedinit - the initial value to be usedpublic static <E,C extends Comparator<E>> E minimum(Iterator<E> iterator, C comparator, E init)
E - the iterator element type parameterC - the comparator type parameteriterator - the iterator to be consumedcomparator - the comparator to be used to evaluate the min elementinit - the initial value to be usedpublic static <E extends Comparable<E>> E minimum(Iterator<E> iterator, E init)
E - the iterator element type parameteriterator - the iterator to be consumedinit - the initial value to be usedCopyright © 2017. All rights reserved.