Top Description Methods
org.eclipse.collections.api

public Interface CharIterable

extends PrimitiveIterable
Known Direct Subinterfaces
org.eclipse.collections.api.LazyCharIterable, org.eclipse.collections.api.bag.primitive.CharBag, org.eclipse.collections.api.collection.primitive.ImmutableCharCollection, org.eclipse.collections.api.collection.primitive.MutableCharCollection, org.eclipse.collections.api.map.primitive.ObjectCharMap, org.eclipse.collections.api.map.primitive.CharValuesMap, org.eclipse.collections.api.ordered.primitive.OrderedCharIterable, org.eclipse.collections.api.set.primitive.CharSet
Imports
java.util.Collection, .NoSuchElementException, .IntSummaryStatistics, .Comparator, org.eclipse.collections.api.block.comparator.primitive.CharComparator, org.eclipse.collections.api.bag.primitive.MutableCharBag, org.eclipse.collections.api.block.function.primitive.CharToBooleanFunction, .CharToByteFunction, .CharToShortFunction, .CharToCharFunction, .CharToDoubleFunction, .CharToFloatFunction, .CharToIntFunction, .CharToLongFunction, .CharToObjectFunction, .BooleanCharToBooleanFunction, .ByteCharToByteFunction, .CharCharToCharFunction, .DoubleCharToDoubleFunction, .FloatCharToFloatFunction, .IntCharToIntFunction, .LongCharToLongFunction, .ObjectCharToObjectFunction, .ShortCharToShortFunction, org.eclipse.collections.api.block.predicate.primitive.CharPredicate, org.eclipse.collections.api.block.procedure.primitive.CharProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.iterator.CharIterator, org.eclipse.collections.api.list.primitive.MutableCharList, org.eclipse.collections.api.set.primitive.CharSet, .MutableCharSet

CharIterable is an interface which is memory-optimized for char 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 CharIterator. CharIterator helps iterate over the CharIterable without boxing the primitives. This file was automatically generated from template file primitiveIterable.stg.

Method Summary

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

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

public boolean
anySatisfy(CharPredicate predicate)

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

public LazyCharIterable
asLazy()

Returns a LazyCharIterable adapter wrapping the source CharIterable.

public double
public default double
averageIfEmpty(double defaultValue)

public CharIterator
charIterator()

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

public default RichIterable<CharIterable>

Returns:

A RichIterable containing CharIterables 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(CharToObjectFunction<? 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(CharToObjectFunction<? extends V> function, R target)

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

public default <R extends MutableBooleanCollection> R
collectBoolean(CharToBooleanFunction 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(CharToByteFunction 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(CharToCharFunction 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(CharToDoubleFunction 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(CharToFloatFunction 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(CharToIntFunction 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(CharToLongFunction 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(CharToShortFunction 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(char value)

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

public default boolean
containsAll(char... source)

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

public default boolean
containsAll(CharIterable source)

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

public default boolean
containsAny(char... source)

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

public default boolean
containsAny(CharIterable source)

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

public default boolean
containsNone(char... source)

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

public default boolean
containsNone(CharIterable source)

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

public int
count(CharPredicate predicate)

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

public char
detectIfNone(CharPredicate predicate, char ifNone)

public void
each(CharProcedure procedure)

A synonym for forEach.

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

flatCollect is a special case of collect(CharToObjectFunction).

public default void
forEach(CharProcedure procedure)

Applies the CharProcedure to each element in the CharIterable.

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

public default boolean
injectIntoBoolean(boolean injectedValue, BooleanCharToBooleanFunction 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, ByteCharToByteFunction 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, CharCharToCharFunction 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, DoubleCharToDoubleFunction 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, FloatCharToFloatFunction 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, IntCharToIntFunction 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, LongCharToLongFunction 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, ShortCharToShortFunction function)

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

public char
max()

public char
maxIfEmpty(char defaultValue)

public double
public default double
medianIfEmpty(double defaultValue)

public char
min()

public char
minIfEmpty(char defaultValue)

public default boolean
noneSatisfy(CharPredicate predicate)

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

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

public CharIterable
reject(CharPredicate predicate)

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

public default <R extends MutableCharCollection> R
reject(CharPredicate predicate, R target)

Same as reject(CharPredicate) , only the results are added to the target MutableCharCollection.

public CharIterable
select(CharPredicate predicate)

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

public default <R extends MutableCharCollection> R
select(CharPredicate predicate, R target)

Same as select(CharPredicate) , only the results are added to the target MutableCharCollection.

public long
sum()

public default IntSummaryStatistics
public default CharIterable
tap(CharProcedure procedure)

public char[]
toArray()

Converts the CharIterable to a primitive char array.

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

Converts the CharIterable to a primitive char array.

public MutableCharBag
toBag()

Converts the CharIterable to a new MutableCharBag.

public MutableCharList
toList()

Converts the CharIterable to a new MutableCharList.

public MutableCharSet
toSet()

Converts the CharIterable to a new MutableCharSet.

public char[]
public MutableCharList
public default MutableCharList
toSortedList(CharComparator comparator)

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

public default <T> MutableCharList
toSortedListBy(CharToObjectFunction<T> function)

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

public default <T> MutableCharList
toSortedListBy(CharToObjectFunction<T> function, Comparator<? super T> comparator)

Converts the collection to a MutableCharList 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(CharPredicate predicate)

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

anySatisfyback to summary
public boolean anySatisfy(CharPredicate predicate)

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

asLazyback to summary
public LazyCharIterable asLazy()

Returns a LazyCharIterable adapter wrapping the source CharIterable.

averageback to summary
public double average()
averageIfEmptyback to summary
public default double averageIfEmpty(double defaultValue)
Since
9.0
charIteratorback to summary
public CharIterator charIterator()

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

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

Partitions elements in fixed size chunks.

Parameters
size:int

the number of elements per chunk

Returns:RichIterable<CharIterable>

A RichIterable containing CharIterables 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(CharToObjectFunction<? 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(CharToObjectFunction<? extends V> function, R target)

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

Since
8.1.
collectBooleanback to summary
public default <R extends MutableBooleanCollection> R collectBoolean(CharToBooleanFunction 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(CharToByteFunction 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(CharToCharFunction 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(CharToDoubleFunction 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(CharToFloatFunction 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(CharToIntFunction 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(CharToLongFunction 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(CharToShortFunction 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(char value)

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

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

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

containsAllback to summary
public default boolean containsAll(CharIterable source)

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

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

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

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

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

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

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

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

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

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

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

detectIfNoneback to summary
public char detectIfNone(CharPredicate predicate, char ifNone)
eachback to summary
public void each(CharProcedure procedure)

A synonym for forEach.

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

flatCollect is a special case of collect(CharToObjectFunction). With collect, when the CharToObjectFunction 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(CharProcedure procedure)

Applies the CharProcedure to each element in the CharIterable.

injectIntoback to summary
public <T> T injectInto(T injectedValue, ObjectCharToObjectFunction<? super T, ? extends T> function)
injectIntoBooleanback to summary
public default boolean injectIntoBoolean(boolean injectedValue, BooleanCharToBooleanFunction 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, ByteCharToByteFunction 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, CharCharToCharFunction 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, DoubleCharToDoubleFunction 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, FloatCharToFloatFunction 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, IntCharToIntFunction 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, LongCharToLongFunction 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, ShortCharToShortFunction 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 char max()
maxIfEmptyback to summary
public char maxIfEmpty(char defaultValue)
medianback to summary
public double median()
medianIfEmptyback to summary
public default double medianIfEmpty(double defaultValue)
Since
9.0
minback to summary
public char min()
minIfEmptyback to summary
public char minIfEmpty(char defaultValue)
noneSatisfyback to summary
public default boolean noneSatisfy(CharPredicate predicate)

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

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

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

rejectback to summary
public default <R extends MutableCharCollection> R reject(CharPredicate predicate, R target)

Same as reject(CharPredicate) , only the results are added to the target MutableCharCollection.

Since
8.1.
selectback to summary
public CharIterable select(CharPredicate predicate)

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

selectback to summary
public default <R extends MutableCharCollection> R select(CharPredicate predicate, R target)

Same as select(CharPredicate) , only the results are added to the target MutableCharCollection.

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

Converts the CharIterable to a primitive char array.

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

Converts the CharIterable to a primitive char 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 MutableCharBag toBag()

Converts the CharIterable to a new MutableCharBag.

toListback to summary
public MutableCharList toList()

Converts the CharIterable to a new MutableCharList.

toSetback to summary
public MutableCharSet toSet()

Converts the CharIterable to a new MutableCharSet.

toSortedArrayback to summary
public char[] toSortedArray()
toSortedListback to summary
public MutableCharList toSortedList()
toSortedListback to summary
public default MutableCharList toSortedList(CharComparator comparator)

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

toSortedListByback to summary
public default <T> MutableCharList toSortedListBy(CharToObjectFunction<T> function)

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

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

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