Top Description Methods
org.eclipse.collections.api

public Interface ByteIterable

extends PrimitiveIterable
Known Direct Subinterfaces
org.eclipse.collections.api.LazyByteIterable, org.eclipse.collections.api.bag.primitive.ByteBag, org.eclipse.collections.api.collection.primitive.ImmutableByteCollection, org.eclipse.collections.api.collection.primitive.MutableByteCollection, org.eclipse.collections.api.map.primitive.ObjectByteMap, org.eclipse.collections.api.map.primitive.ByteValuesMap, org.eclipse.collections.api.ordered.primitive.OrderedByteIterable, org.eclipse.collections.api.set.primitive.ByteSet
Imports
java.util.Collection, .NoSuchElementException, .IntSummaryStatistics, .Comparator, org.eclipse.collections.api.block.comparator.primitive.ByteComparator, org.eclipse.collections.api.bag.primitive.MutableByteBag, org.eclipse.collections.api.block.function.primitive.ByteToBooleanFunction, .ByteToByteFunction, .ByteToShortFunction, .ByteToCharFunction, .ByteToDoubleFunction, .ByteToFloatFunction, .ByteToIntFunction, .ByteToLongFunction, .ByteToObjectFunction, .BooleanByteToBooleanFunction, .ByteByteToByteFunction, .CharByteToCharFunction, .DoubleByteToDoubleFunction, .FloatByteToFloatFunction, .IntByteToIntFunction, .LongByteToLongFunction, .ObjectByteToObjectFunction, .ShortByteToShortFunction, org.eclipse.collections.api.block.predicate.primitive.BytePredicate, org.eclipse.collections.api.block.procedure.primitive.ByteProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.iterator.ByteIterator, org.eclipse.collections.api.list.primitive.MutableByteList, org.eclipse.collections.api.set.primitive.ByteSet, .MutableByteSet

ByteIterable is an interface which is memory-optimized for byte primitives. It is inspired by the interface RichIterable, and contains a subset of the internal iterator methods on RichIterable like collect, sum, etc. The API also includes an external iterator method, which returns an ByteIterator. ByteIterator helps iterate over the ByteIterable without boxing the primitives. This file was automatically generated from template file primitiveIterable.stg.

Method Summary

Modifier and TypeMethod and Description
public boolean
allSatisfy(BytePredicate predicate)

Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

public boolean
anySatisfy(BytePredicate predicate)

Returns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

public LazyByteIterable
asLazy()

Returns a LazyByteIterable adapter wrapping the source ByteIterable.

public double
public default double
averageIfEmpty(double defaultValue)

public ByteIterator
byteIterator()

Returns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.

public default RichIterable<ByteIterable>

Returns:

A RichIterable containing ByteIterables of size size, except the last will be truncated if the elements don't divide evenly.
chunk
(int
the number of elements per chunk
size
)

Partitions elements in fixed size chunks.

public <V> RichIterable<V>
collect(ByteToObjectFunction<? extends V> function)

Returns a new collection with the results of applying the specified function on each element of the source collection.

public default <V, R extends Collection<V>> R
collect(ByteToObjectFunction<? extends V> function, R target)

Same as collect(ByteToObjectFunction) , only the results are added to the target Collection.

public default <R extends MutableBooleanCollection> R
collectBoolean(ByteToBooleanFunction function, R target)

Returns the target MutableBooleanCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableByteCollection> R
collectByte(ByteToByteFunction function, R target)

Returns the target MutableByteCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableCharCollection> R
collectChar(ByteToCharFunction function, R target)

Returns the target MutableCharCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableDoubleCollection> R
collectDouble(ByteToDoubleFunction function, R target)

Returns the target MutableDoubleCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableFloatCollection> R
collectFloat(ByteToFloatFunction function, R target)

Returns the target MutableFloatCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableIntCollection> R
collectInt(ByteToIntFunction function, R target)

Returns the target MutableIntCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableLongCollection> R
collectLong(ByteToLongFunction function, R target)

Returns the target MutableLongCollection with the results of applying the specified function on each element of the source collection.

public default <R extends MutableShortCollection> R
collectShort(ByteToShortFunction function, R target)

Returns the target MutableShortCollection with the results of applying the specified function on each element of the source collection.

public boolean
contains(byte value)

Returns true if the value is contained in the ByteIterable, and false if it is not.

public default boolean
containsAll(byte... source)

Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.

public default boolean
containsAll(ByteIterable source)

Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.

public default boolean
containsAny(byte... source)

Returns true if any of the values specified in the source array are contained in the ByteIterable, and false if they are not.

public default boolean
containsAny(ByteIterable source)

Returns true if any of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.

public default boolean
containsNone(byte... source)

Returns true if none of the values specified in the source array are contained in the ByteIterable, and false if they are.

public default boolean
containsNone(ByteIterable source)

Returns true if none of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are.

public int
count(BytePredicate predicate)

Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.

public byte
detectIfNone(BytePredicate predicate, byte ifNone)

public void
each(ByteProcedure procedure)

A synonym for forEach.

public default <V, R extends Collection<V>> R
flatCollect(ByteToObjectFunction<? extends Iterable<V>> function, R target)

flatCollect is a special case of collect(ByteToObjectFunction).

public default void
forEach(ByteProcedure procedure)

Applies the ByteProcedure to each element in the ByteIterable.

public <T> T
injectInto(T injectedValue, ObjectByteToObjectFunction<? super T, ? extends T> function)

public default boolean
injectIntoBoolean(boolean injectedValue, BooleanByteToBooleanFunction function)

Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default byte
injectIntoByte(byte injectedValue, ByteByteToByteFunction function)

Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default char
injectIntoChar(char injectedValue, CharByteToCharFunction function)

Returns the final char result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default double
injectIntoDouble(double injectedValue, DoubleByteToDoubleFunction function)

Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default float
injectIntoFloat(float injectedValue, FloatByteToFloatFunction function)

Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default int
injectIntoInt(int injectedValue, IntByteToIntFunction function)

Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default long
injectIntoLong(long injectedValue, LongByteToLongFunction function)

Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public default short
injectIntoShort(short injectedValue, ShortByteToShortFunction function)

Returns the final short result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public byte
max()

public byte
maxIfEmpty(byte defaultValue)

public double
public default double
medianIfEmpty(double defaultValue)

public byte
min()

public byte
minIfEmpty(byte defaultValue)

public default boolean
noneSatisfy(BytePredicate predicate)

Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

public default long
public default long
reduceIfEmpty(LongByteToLongFunction accumulator, long defaultValue)

public ByteIterable
reject(BytePredicate predicate)

Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.

public default <R extends MutableByteCollection> R
reject(BytePredicate predicate, R target)

Same as reject(BytePredicate) , only the results are added to the target MutableByteCollection.

public ByteIterable
select(BytePredicate predicate)

Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.

public default <R extends MutableByteCollection> R
select(BytePredicate predicate, R target)

Same as select(BytePredicate) , only the results are added to the target MutableByteCollection.

public long
sum()

public default IntSummaryStatistics
public default ByteIterable
tap(ByteProcedure procedure)

public byte[]
toArray()

Converts the ByteIterable to a primitive byte array.

public default byte[]
toArray(byte[] target)

Converts the ByteIterable to a primitive byte array.

public MutableByteBag
toBag()

Converts the ByteIterable to a new MutableByteBag.

public MutableByteList
toList()

Converts the ByteIterable to a new MutableByteList.

public MutableByteSet
toSet()

Converts the ByteIterable to a new MutableByteSet.

public byte[]
public MutableByteList
public default MutableByteList
toSortedList(ByteComparator comparator)

Converts the collection to a MutableByteList implementation sorted using the provided comparator.

public default <T> MutableByteList
toSortedListBy(ByteToObjectFunction<T> function)

Converts the collection to a MutableByteListImplementation sorted based on the natural order of the key returned by function.

public default <T> MutableByteList
toSortedListBy(ByteToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableByteList implementation, which is sorted based on the key returned by function using the provided comparator.

Inherited from org.eclipse.collections.api.PrimitiveIterable:
appendStringappendStringappendStringisEmptymakeStringmakeStringmakeStringnotEmptysizetoString

Method Detail

allSatisfyback to summary
public boolean allSatisfy(BytePredicate predicate)

Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

anySatisfyback to summary
public boolean anySatisfy(BytePredicate predicate)

Returns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

asLazyback to summary
public LazyByteIterable asLazy()

Returns a LazyByteIterable adapter wrapping the source ByteIterable.

averageback to summary
public double average()
averageIfEmptyback to summary
public default double averageIfEmpty(double defaultValue)
Since
9.0
byteIteratorback to summary
public ByteIterator byteIterator()

Returns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.

chunkback to summary
public default RichIterable<ByteIterable> chunk(int size)

Partitions elements in fixed size chunks.

Parameters
size:int

the number of elements per chunk

Returns:RichIterable<ByteIterable>

A RichIterable containing ByteIterables of size size, except the last will be truncated if the elements don't divide evenly.

Since
9.2
collectback to summary
public <V> RichIterable<V> collect(ByteToObjectFunction<? extends V> function)

Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

collectback to summary
public default <V, R extends Collection<V>> R collect(ByteToObjectFunction<? extends V> function, R target)

Same as collect(ByteToObjectFunction) , only the results are added to the target Collection.

Since
8.1.
collectBooleanback to summary
public default <R extends MutableBooleanCollection> R collectBoolean(ByteToBooleanFunction function, R target)

Returns the target MutableBooleanCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectByteback to summary
public default <R extends MutableByteCollection> R collectByte(ByteToByteFunction function, R target)

Returns the target MutableByteCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectCharback to summary
public default <R extends MutableCharCollection> R collectChar(ByteToCharFunction function, R target)

Returns the target MutableCharCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectDoubleback to summary
public default <R extends MutableDoubleCollection> R collectDouble(ByteToDoubleFunction function, R target)

Returns the target MutableDoubleCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectFloatback to summary
public default <R extends MutableFloatCollection> R collectFloat(ByteToFloatFunction function, R target)

Returns the target MutableFloatCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectIntback to summary
public default <R extends MutableIntCollection> R collectInt(ByteToIntFunction function, R target)

Returns the target MutableIntCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectLongback to summary
public default <R extends MutableLongCollection> R collectLong(ByteToLongFunction function, R target)

Returns the target MutableLongCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
collectShortback to summary
public default <R extends MutableShortCollection> R collectShort(ByteToShortFunction function, R target)

Returns the target MutableShortCollection with the results of applying the specified function on each element of the source collection.

Since
8.1.
containsback to summary
public boolean contains(byte value)

Returns true if the value is contained in the ByteIterable, and false if it is not.

containsAllback to summary
public default boolean containsAll(byte... source)

Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.

containsAllback to summary
public default boolean containsAll(ByteIterable source)

Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.

containsAnyback to summary
public default boolean containsAny(byte... source)

Returns true if any of the values specified in the source array are contained in the ByteIterable, and false if they are not.

Since
11.0
containsAnyback to summary
public default boolean containsAny(ByteIterable source)

Returns true if any of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.

Since
11.0
containsNoneback to summary
public default boolean containsNone(byte... source)

Returns true if none of the values specified in the source array are contained in the ByteIterable, and false if they are.

Since
11.0
containsNoneback to summary
public default boolean containsNone(ByteIterable source)

Returns true if none of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are.

Since
11.0
countback to summary
public int count(BytePredicate predicate)

Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.

detectIfNoneback to summary
public byte detectIfNone(BytePredicate predicate, byte ifNone)
eachback to summary
public void each(ByteProcedure procedure)

A synonym for forEach.

Since
7.0.
flatCollectback to summary
public default <V, R extends Collection<V>> R flatCollect(ByteToObjectFunction<? extends Iterable<V>> function, R target)

flatCollect is a special case of collect(ByteToObjectFunction). With collect, when the ByteToObjectFunction returns a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection instead. This method is commonly called flatMap.

Since
8.1.
forEachback to summary
public default void forEach(ByteProcedure procedure)

Applies the ByteProcedure to each element in the ByteIterable.

injectIntoback to summary
public <T> T injectInto(T injectedValue, ObjectByteToObjectFunction<? super T, ? extends T> function)
injectIntoBooleanback to summary
public default boolean injectIntoBoolean(boolean injectedValue, BooleanByteToBooleanFunction function)

Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoByteback to summary
public default byte injectIntoByte(byte injectedValue, ByteByteToByteFunction function)

Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoCharback to summary
public default char injectIntoChar(char injectedValue, CharByteToCharFunction function)

Returns the final char result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoDoubleback to summary
public default double injectIntoDouble(double injectedValue, DoubleByteToDoubleFunction function)

Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoFloatback to summary
public default float injectIntoFloat(float injectedValue, FloatByteToFloatFunction function)

Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoIntback to summary
public default int injectIntoInt(int injectedValue, IntByteToIntFunction function)

Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoLongback to summary
public default long injectIntoLong(long injectedValue, LongByteToLongFunction function)

Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
injectIntoShortback to summary
public default short injectIntoShort(short injectedValue, ShortByteToShortFunction function)

Returns the final short result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.

Since
11.1
maxback to summary
public byte max()
maxIfEmptyback to summary
public byte maxIfEmpty(byte defaultValue)
medianback to summary
public double median()
medianIfEmptyback to summary
public default double medianIfEmpty(double defaultValue)
Since
9.0
minback to summary
public byte min()
minIfEmptyback to summary
public byte minIfEmpty(byte defaultValue)
noneSatisfyback to summary
public default boolean noneSatisfy(BytePredicate predicate)

Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.

reduceback to summary
public default long reduce(LongByteToLongFunction accumulator)
Since
10.0
See Also
RichIterable#reduce(BinaryOperator)
reduceIfEmptyback to summary
public default long reduceIfEmpty(LongByteToLongFunction accumulator, long defaultValue)
Since
10.0
See Also
reduce(LongByteToLongFunction)
rejectback to summary
public ByteIterable reject(BytePredicate predicate)

Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.

rejectback to summary
public default <R extends MutableByteCollection> R reject(BytePredicate predicate, R target)

Same as reject(BytePredicate) , only the results are added to the target MutableByteCollection.

Since
8.1.
selectback to summary
public ByteIterable select(BytePredicate predicate)

Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.

selectback to summary
public default <R extends MutableByteCollection> R select(BytePredicate predicate, R target)

Same as select(BytePredicate) , only the results are added to the target MutableByteCollection.

Since
8.1.
sumback to summary
public long sum()
summaryStatisticsback to summary
public default IntSummaryStatistics summaryStatistics()
Since
8.0
tapback to summary
public default ByteIterable tap(ByteProcedure procedure)
Since
9.0.
toArrayback to summary
public byte[] toArray()

Converts the ByteIterable to a primitive byte array.

toArrayback to summary
public default byte[] toArray(byte[] target)

Converts the ByteIterable to a primitive byte array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.

toBagback to summary
public MutableByteBag toBag()

Converts the ByteIterable to a new MutableByteBag.

toListback to summary
public MutableByteList toList()

Converts the ByteIterable to a new MutableByteList.

toSetback to summary
public MutableByteSet toSet()

Converts the ByteIterable to a new MutableByteSet.

toSortedArrayback to summary
public byte[] toSortedArray()
toSortedListback to summary
public MutableByteList toSortedList()
toSortedListback to summary
public default MutableByteList toSortedList(ByteComparator comparator)

Converts the collection to a MutableByteList implementation sorted using the provided comparator.

toSortedListByback to summary
public default <T> MutableByteList toSortedListBy(ByteToObjectFunction<T> function)

Converts the collection to a MutableByteListImplementation sorted based on the natural order of the key returned by function.

toSortedListByback to summary
public default <T> MutableByteList toSortedListBy(ByteToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableByteList implementation, which is sorted based on the key returned by function using the provided comparator.