public interface LongIterable extends PrimitiveIterable
| Modifier and Type | Method and Description |
|---|---|
boolean |
allSatisfy(LongPredicate predicate)
Returns true if all of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(LongPredicate predicate)
Returns true if any of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
LazyLongIterable |
asLazy()
Returns a LazyLongIterable adapter wrapping the source LongIterable.
|
double |
average() |
default double |
averageIfEmpty(double defaultValue) |
default RichIterable<LongIterable> |
chunk(int size)
Partitions elements in fixed size chunks.
|
<V> RichIterable<V> |
collect(LongToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
default <V,R extends Collection<V>> |
collect(LongToObjectFunction<? extends V> function,
R target)
Same as
collect(LongToObjectFunction) , only the results are added to the target Collection. |
default <R extends MutableBooleanCollection> |
collectBoolean(LongToBooleanFunction function,
R target)
Returns the target
MutableBooleanCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableByteCollection> |
collectByte(LongToByteFunction function,
R target)
Returns the target
MutableByteCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableCharCollection> |
collectChar(LongToCharFunction function,
R target)
Returns the target
MutableCharCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableDoubleCollection> |
collectDouble(LongToDoubleFunction function,
R target)
Returns the target
MutableDoubleCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableFloatCollection> |
collectFloat(LongToFloatFunction function,
R target)
Returns the target
MutableFloatCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableIntCollection> |
collectInt(LongToIntFunction function,
R target)
Returns the target
MutableIntCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableLongCollection> |
collectLong(LongToLongFunction function,
R target)
Returns the target
MutableLongCollection with the results of applying the specified function on each element
of the source collection. |
default <R extends MutableShortCollection> |
collectShort(LongToShortFunction function,
R target)
Returns the target
MutableShortCollection with the results of applying the specified function on each element
of the source collection. |
boolean |
contains(long value)
Returns true if the value is contained in the LongIterable, and false if it is not.
|
default boolean |
containsAll(long... source)
Returns true if all of the values specified in the source array are contained
in the LongIterable, and false if they are not.
|
default boolean |
containsAll(LongIterable source)
Returns true if all of the values specified in the source LongIterable are contained
in the LongIterable, and false if they are not.
|
default boolean |
containsAny(long... source)
Returns true if any of the values specified in the source array are contained
in the LongIterable, and false if they are not.
|
default boolean |
containsAny(LongIterable source)
Returns true if any of the values specified in the source LongIterable are contained
in the LongIterable, and false if they are not.
|
default boolean |
containsNone(long... source)
Returns true if none of the values specified in the source array are contained
in the LongIterable, and false if they are.
|
default boolean |
containsNone(LongIterable source)
Returns true if none of the values specified in the source LongIterable are contained
in the LongIterable, and false if they are.
|
int |
count(LongPredicate predicate)
Returns a count of the number of elements in the LongIterable that return true for the
specified predicate.
|
long |
detectIfNone(LongPredicate predicate,
long ifNone) |
void |
each(LongProcedure procedure)
A synonym for forEach.
|
default <V,R extends Collection<V>> |
flatCollect(LongToObjectFunction<? extends Iterable<V>> function,
R target)
flatCollect is a special case of collect(LongToObjectFunction). |
default void |
forEach(LongProcedure procedure)
Applies the LongProcedure to each element in the LongIterable.
|
<T> T |
injectInto(T injectedValue,
ObjectLongToObjectFunction<? super T,? extends T> function) |
default boolean |
injectIntoBoolean(boolean injectedValue,
BooleanLongToBooleanFunction function)
Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default byte |
injectIntoByte(byte injectedValue,
ByteLongToByteFunction function)
Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default char |
injectIntoChar(char injectedValue,
CharLongToCharFunction function)
Returns the final char result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default double |
injectIntoDouble(double injectedValue,
DoubleLongToDoubleFunction function)
Returns the final double result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default float |
injectIntoFloat(float injectedValue,
FloatLongToFloatFunction function)
Returns the final float result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default int |
injectIntoInt(int injectedValue,
IntLongToIntFunction function)
Returns the final int result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default long |
injectIntoLong(long injectedValue,
LongLongToLongFunction function)
Returns the final long result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
default short |
injectIntoShort(short injectedValue,
ShortLongToShortFunction function)
Returns the final short result of evaluating function using each element of the iterable and the previous evaluation
result as the parameters.
|
LongIterator |
longIterator()
Returns a primitive iterator that can be used to iterate over the LongIterable in an
imperative style.
|
long |
max() |
long |
maxIfEmpty(long defaultValue) |
double |
median() |
default double |
medianIfEmpty(double defaultValue) |
long |
min() |
long |
minIfEmpty(long defaultValue) |
default boolean |
noneSatisfy(LongPredicate predicate)
Returns true if none of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
default long |
reduce(LongLongToLongFunction accumulator) |
default long |
reduceIfEmpty(LongLongToLongFunction accumulator,
long defaultValue) |
LongIterable |
reject(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that
return false for the specified predicate.
|
default <R extends MutableLongCollection> |
reject(LongPredicate predicate,
R target)
Same as
reject(LongPredicate) , only the results are added to the target MutableLongCollection. |
LongIterable |
select(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that
return true for the specified predicate.
|
default <R extends MutableLongCollection> |
select(LongPredicate predicate,
R target)
Same as
select(LongPredicate) , only the results are added to the target MutableLongCollection. |
long |
sum() |
default LongSummaryStatistics |
summaryStatistics() |
default LongIterable |
tap(LongProcedure procedure) |
long[] |
toArray()
Converts the LongIterable to a primitive long array.
|
default long[] |
toArray(long[] target)
Converts the LongIterable to a primitive long array.
|
MutableLongBag |
toBag()
Converts the LongIterable to a new MutableLongBag.
|
MutableLongList |
toList()
Converts the LongIterable to a new MutableLongList.
|
MutableLongSet |
toSet()
Converts the LongIterable to a new MutableLongSet.
|
long[] |
toSortedArray() |
MutableLongList |
toSortedList() |
default MutableLongList |
toSortedList(LongComparator comparator)
Converts the collection to a MutableLongList implementation sorted using the provided comparator.
|
default <T> MutableLongList |
toSortedListBy(LongToObjectFunction<T> function)
Converts the collection to a MutableLongListImplementation sorted based on the natural order of the key returned
by
function. |
default <T> MutableLongList |
toSortedListBy(LongToObjectFunction<T> function,
Comparator<? super T> comparator)
Converts the collection to a MutableLongList implementation, which is sorted based on the key returned by
function using the provided comparator. |
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toStringLongIterator longIterator()
long[] toArray()
default long[] toArray(long[] target)
boolean contains(long value)
default boolean containsAll(long... source)
default boolean containsAll(LongIterable source)
default boolean containsAny(long... source)
default boolean containsAny(LongIterable source)
default boolean containsNone(long... source)
default boolean containsNone(LongIterable source)
default void forEach(LongProcedure procedure)
void each(LongProcedure procedure)
default LongIterable tap(LongProcedure procedure)
LongIterable select(LongPredicate predicate)
LongIterable reject(LongPredicate predicate)
default <R extends MutableLongCollection> R select(LongPredicate predicate, R target)
select(LongPredicate) , only the results are added to the target MutableLongCollection.default <R extends MutableLongCollection> R reject(LongPredicate predicate, R target)
reject(LongPredicate) , only the results are added to the target MutableLongCollection.<V> RichIterable<V> collect(LongToObjectFunction<? extends V> function)
default <V,R extends Collection<V>> R collect(LongToObjectFunction<? extends V> function, R target)
collect(LongToObjectFunction) , only the results are added to the target Collection.default <V,R extends Collection<V>> R flatCollect(LongToObjectFunction<? extends Iterable<V>> function, R target)
flatCollect is a special case of collect(LongToObjectFunction). With collect, when the LongToObjectFunction returns
a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection
instead. This method is commonly called flatMap.default <R extends MutableBooleanCollection> R collectBoolean(LongToBooleanFunction function, R target)
MutableBooleanCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableByteCollection> R collectByte(LongToByteFunction function, R target)
MutableByteCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableCharCollection> R collectChar(LongToCharFunction function, R target)
MutableCharCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableShortCollection> R collectShort(LongToShortFunction function, R target)
MutableShortCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableIntCollection> R collectInt(LongToIntFunction function, R target)
MutableIntCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableFloatCollection> R collectFloat(LongToFloatFunction function, R target)
MutableFloatCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableLongCollection> R collectLong(LongToLongFunction function, R target)
MutableLongCollection with the results of applying the specified function on each element
of the source collection.default <R extends MutableDoubleCollection> R collectDouble(LongToDoubleFunction function, R target)
MutableDoubleCollection with the results of applying the specified function on each element
of the source collection.long detectIfNone(LongPredicate predicate, long ifNone)
int count(LongPredicate predicate)
boolean anySatisfy(LongPredicate predicate)
boolean allSatisfy(LongPredicate predicate)
default boolean noneSatisfy(LongPredicate predicate)
MutableLongList toList()
MutableLongSet toSet()
MutableLongBag toBag()
LazyLongIterable asLazy()
<T> T injectInto(T injectedValue,
ObjectLongToObjectFunction<? super T,? extends T> function)
default boolean injectIntoBoolean(boolean injectedValue,
BooleanLongToBooleanFunction function)
default byte injectIntoByte(byte injectedValue,
ByteLongToByteFunction function)
default char injectIntoChar(char injectedValue,
CharLongToCharFunction function)
default short injectIntoShort(short injectedValue,
ShortLongToShortFunction function)
default int injectIntoInt(int injectedValue,
IntLongToIntFunction function)
default float injectIntoFloat(float injectedValue,
FloatLongToFloatFunction function)
default long injectIntoLong(long injectedValue,
LongLongToLongFunction function)
default double injectIntoDouble(double injectedValue,
DoubleLongToDoubleFunction function)
default long reduceIfEmpty(LongLongToLongFunction accumulator, long defaultValue)
reduce(LongLongToLongFunction)default long reduce(LongLongToLongFunction accumulator)
RichIterable.reduce(BinaryOperator)default RichIterable<LongIterable> chunk(int size)
size - the number of elements per chunkRichIterable containing LongIterables of size size, except the last will be
truncated if the elements don't divide evenly.long sum()
default LongSummaryStatistics summaryStatistics()
long max()
long maxIfEmpty(long defaultValue)
long min()
long minIfEmpty(long defaultValue)
double average()
default double averageIfEmpty(double defaultValue)
double median()
default double medianIfEmpty(double defaultValue)
long[] toSortedArray()
MutableLongList toSortedList()
default MutableLongList toSortedList(LongComparator comparator)
default <T> MutableLongList toSortedListBy(LongToObjectFunction<T> function)
function.default <T> MutableLongList toSortedListBy(LongToObjectFunction<T> function, Comparator<? super T> comparator)
function using the provided comparator.Copyright © 2004–2022. All rights reserved.