Package org.eclipse.collections.api
Interface CharIterable
- All Superinterfaces:
PrimitiveIterable
- All Known Subinterfaces:
ByteCharMap
,CharBag
,CharCharMap
,CharList
,CharSet
,CharStack
,CharValuesMap
,DoubleCharMap
,FloatCharMap
,ImmutableByteCharMap
,ImmutableCharBag
,ImmutableCharCharMap
,ImmutableCharCollection
,ImmutableCharList
,ImmutableCharSet
,ImmutableCharStack
,ImmutableDoubleCharMap
,ImmutableFloatCharMap
,ImmutableIntCharMap
,ImmutableLongCharMap
,ImmutableObjectCharMap<K>
,ImmutableShortCharMap
,IntCharMap
,LazyCharIterable
,LongCharMap
,MutableByteCharMap
,MutableCharBag
,MutableCharCharMap
,MutableCharCollection
,MutableCharList
,MutableCharSet
,MutableCharStack
,MutableCharValuesMap
,MutableDoubleCharMap
,MutableFloatCharMap
,MutableIntCharMap
,MutableLongCharMap
,MutableObjectCharMap<K>
,MutableShortCharMap
,ObjectCharMap<K>
,OrderedCharIterable
,ReversibleCharIterable
,ShortCharMap
- All Known Implementing Classes:
AbstractCharIterable
,AbstractCharSet
,AbstractCharStack
,AbstractImmutableCharSet
,AbstractImmutableObjectCharMap
,AbstractLazyCharIterable
,AbstractMutableCharKeySet
,AbstractMutableCharValuesMap
,AbstractSynchronizedCharCollection
,AbstractUnmodifiableCharCollection
,ByteCharHashMap
,CharAdapter
,CharArrayList
,CharArrayStack
,CharCharHashMap
,CharHashBag
,CharHashSet
,CollectBooleanToCharIterable
,CollectByteToCharIterable
,CollectCharIterable
,CollectCharToCharIterable
,CollectDoubleToCharIterable
,CollectFloatToCharIterable
,CollectIntToCharIterable
,CollectLongToCharIterable
,CollectShortToCharIterable
,DoubleCharHashMap
,FloatCharHashMap
,IntCharHashMap
,LazyCharIterableAdapter
,LongCharHashMap
,ObjectCharHashMap
,ObjectCharHashMapWithHashingStrategy
,ReverseCharIterable
,SelectCharIterable
,ShortCharHashMap
,SynchronizedByteCharMap
,SynchronizedCharBag
,SynchronizedCharCharMap
,SynchronizedCharCollection
,SynchronizedCharIterable
,SynchronizedCharList
,SynchronizedCharSet
,SynchronizedCharStack
,SynchronizedDoubleCharMap
,SynchronizedFloatCharMap
,SynchronizedIntCharMap
,SynchronizedLongCharMap
,SynchronizedObjectCharMap
,SynchronizedShortCharMap
,TapCharIterable
,UnmodifiableByteCharMap
,UnmodifiableCharBag
,UnmodifiableCharCharMap
,UnmodifiableCharCollection
,UnmodifiableCharList
,UnmodifiableCharSet
,UnmodifiableCharStack
,UnmodifiableDoubleCharMap
,UnmodifiableFloatCharMap
,UnmodifiableIntCharMap
,UnmodifiableLongCharMap
,UnmodifiableObjectCharMap
,UnmodifiableShortCharMap
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 TypeMethodDescriptionboolean
allSatisfy
(CharPredicate predicate) Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy
(CharPredicate predicate) Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false.asLazy()
Returns a LazyCharIterable adapter wrapping the source CharIterable.double
average()
default double
averageIfEmpty
(double defaultValue) Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.default RichIterable<CharIterable>
chunk
(int size) Partitions elements in fixed size chunks.<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.default <V,
R extends Collection<V>>
Rcollect
(CharToObjectFunction<? extends V> function, R target) Same ascollect(CharToObjectFunction)
, only the results are added to the target Collection.default <R extends MutableBooleanCollection>
RcollectBoolean
(CharToBooleanFunction function, R target) Returns the targetMutableBooleanCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableByteCollection>
RcollectByte
(CharToByteFunction function, R target) Returns the targetMutableByteCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableCharCollection>
RcollectChar
(CharToCharFunction function, R target) Returns the targetMutableCharCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableDoubleCollection>
RcollectDouble
(CharToDoubleFunction function, R target) Returns the targetMutableDoubleCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableFloatCollection>
RcollectFloat
(CharToFloatFunction function, R target) Returns the targetMutableFloatCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableIntCollection>
RcollectInt
(CharToIntFunction function, R target) Returns the targetMutableIntCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableLongCollection>
RcollectLong
(CharToLongFunction function, R target) Returns the targetMutableLongCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableShortCollection>
RcollectShort
(CharToShortFunction function, R target) Returns the targetMutableShortCollection
with the results of applying the specified function on each element of the source collection.boolean
contains
(char value) Returns true if the value is contained in the CharIterable, and false if it is not.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.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.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.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.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.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.int
count
(CharPredicate predicate) Returns a count of the number of elements in the CharIterable that return true for the specified predicate.char
detectIfNone
(CharPredicate predicate, char ifNone) void
each
(CharProcedure procedure) A synonym for forEach.default <V,
R extends Collection<V>>
RflatCollect
(CharToObjectFunction<? extends Iterable<V>> function, R target) flatCollect
is a special case ofcollect(CharToObjectFunction)
.default void
forEach
(CharProcedure procedure) Applies the CharProcedure to each element in the CharIterable.<T> T
injectInto
(T injectedValue, ObjectCharToObjectFunction<? super T, ? extends T> function) 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.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.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.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.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.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.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.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.char
max()
char
maxIfEmpty
(char defaultValue) double
median()
default double
medianIfEmpty
(double defaultValue) char
min()
char
minIfEmpty
(char defaultValue) default boolean
noneSatisfy
(CharPredicate predicate) Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.default long
reduce
(LongCharToLongFunction accumulator) default long
reduceIfEmpty
(LongCharToLongFunction accumulator, long defaultValue) reject
(CharPredicate predicate) Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.default <R extends MutableCharCollection>
Rreject
(CharPredicate predicate, R target) Same asreject(CharPredicate)
, only the results are added to the target MutableCharCollection.select
(CharPredicate predicate) Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.default <R extends MutableCharCollection>
Rselect
(CharPredicate predicate, R target) Same asselect(CharPredicate)
, only the results are added to the target MutableCharCollection.long
sum()
default IntSummaryStatistics
default CharIterable
tap
(CharProcedure procedure) char[]
toArray()
Converts the CharIterable to a primitive char array.default char[]
toArray
(char[] target) Converts the CharIterable to a primitive char array.toBag()
Converts the CharIterable to a new MutableCharBag.toList()
Converts the CharIterable to a new MutableCharList.toSet()
Converts the CharIterable to a new MutableCharSet.char[]
default MutableCharList
toSortedList
(CharComparator comparator) Converts the collection to a MutableCharList implementation sorted using the provided comparator.default <T> MutableCharList
toSortedListBy
(CharToObjectFunction<T> function) Converts the collection to a MutableCharListImplementation sorted based on the natural order of the key returned byfunction
.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 byfunction
using the providedcomparator
.Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
Method Details
-
charIterator
CharIterator charIterator()Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style. -
toArray
char[] toArray()Converts the CharIterable to a primitive char array. -
toArray
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. -
contains
boolean contains(char value) Returns true if the value is contained in the CharIterable, and false if it is not. -
containsAll
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. -
containsAll
Returns true if all of the values specified in the source CharIterable are contained in the CharIterable, and false if they are not. -
containsAny
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
-
containsAny
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
-
containsNone
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
-
containsNone
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
-
forEach
Applies the CharProcedure to each element in the CharIterable. -
each
A synonym for forEach.- Since:
- 7.0.
-
tap
- Since:
- 9.0.
-
select
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate. -
reject
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate. -
select
Same asselect(CharPredicate)
, only the results are added to the target MutableCharCollection.- Since:
- 8.1.
-
reject
Same asreject(CharPredicate)
, only the results are added to the target MutableCharCollection.- Since:
- 8.1.
-
collect
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. -
collect
default <V,R extends Collection<V>> R collect(CharToObjectFunction<? extends V> function, R target) Same ascollect(CharToObjectFunction)
, only the results are added to the target Collection.- Since:
- 8.1.
-
flatCollect
default <V,R extends Collection<V>> R flatCollect(CharToObjectFunction<? extends Iterable<V>> function, R target) flatCollect
is a special case ofcollect(CharToObjectFunction)
. Withcollect
, when theCharToObjectFunction
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.
-
collectBoolean
default <R extends MutableBooleanCollection> R collectBoolean(CharToBooleanFunction function, R target) Returns the targetMutableBooleanCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectByte
Returns the targetMutableByteCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectChar
Returns the targetMutableCharCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectShort
Returns the targetMutableShortCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectInt
Returns the targetMutableIntCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectFloat
Returns the targetMutableFloatCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectLong
Returns the targetMutableLongCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectDouble
default <R extends MutableDoubleCollection> R collectDouble(CharToDoubleFunction function, R target) Returns the targetMutableDoubleCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
detectIfNone
-
count
Returns a count of the number of elements in the CharIterable that return true for the specified predicate. -
anySatisfy
Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false. -
allSatisfy
Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false. -
noneSatisfy
Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false. -
toList
MutableCharList toList()Converts the CharIterable to a new MutableCharList. -
toSet
MutableCharSet toSet()Converts the CharIterable to a new MutableCharSet. -
toBag
MutableCharBag toBag()Converts the CharIterable to a new MutableCharBag. -
asLazy
LazyCharIterable asLazy()Returns a LazyCharIterable adapter wrapping the source CharIterable. -
injectInto
-
injectIntoBoolean
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
-
injectIntoByte
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
-
injectIntoChar
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
-
injectIntoShort
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
-
injectIntoInt
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
-
injectIntoFloat
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
-
injectIntoLong
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
-
injectIntoDouble
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
-
reduceIfEmpty
- Since:
- 10.0
- See Also:
-
reduce
- Since:
- 10.0
- See Also:
-
chunk
Partitions elements in fixed size chunks.- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingCharIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly. - Since:
- 9.2
-
sum
long sum() -
summaryStatistics
- Since:
- 8.0
-
max
char max() -
maxIfEmpty
char maxIfEmpty(char defaultValue) -
min
char min() -
minIfEmpty
char minIfEmpty(char defaultValue) -
average
double average() -
averageIfEmpty
default double averageIfEmpty(double defaultValue) - Since:
- 9.0
-
median
double median() -
medianIfEmpty
default double medianIfEmpty(double defaultValue) - Since:
- 9.0
-
toSortedArray
char[] toSortedArray() -
toSortedList
MutableCharList toSortedList() -
toSortedList
Converts the collection to a MutableCharList implementation sorted using the provided comparator. -
toSortedListBy
Converts the collection to a MutableCharListImplementation sorted based on the natural order of the key returned byfunction
. -
toSortedListBy
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 byfunction
using the providedcomparator
.
-