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

public interface CharIterable
extends PrimitiveIterable
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 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

      boolean containsAll​(char... source)
      Returns true if the all of the values specified in the source array are contained in the CharIterable, and false if they are not.
    • containsAll

      boolean containsAll​(CharIterable source)
      Returns true if the all of the values specified in the source CharIterable are contained in the CharIterable, and false if they are not.
    • forEach

      void forEach​(CharProcedure procedure)
      Applies the CharProcedure to each element in the CharIterable.
    • each

      void each​(CharProcedure procedure)
      A synonym for forEach.
      Since:
      7.0.
    • tap

      default CharIterable tap​(CharProcedure procedure)
      Since:
      9.0.
    • select

      CharIterable select​(CharPredicate predicate)
      Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.
    • reject

      CharIterable reject​(CharPredicate predicate)
      Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.
    • select

      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.
    • reject

      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.
    • collect

      <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.
    • collect

      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.
    • flatCollect

      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.
    • collectBoolean

      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.
    • collectByte

      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.
    • collectChar

      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.
    • collectShort

      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.
    • collectInt

      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.
    • collectFloat

      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.
    • collectLong

      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.
    • collectDouble

      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.
    • detectIfNone

      char detectIfNone​(CharPredicate predicate, char ifNone)
    • count

      int count​(CharPredicate predicate)
      Returns a count of the number of elements in the CharIterable that return true for the specified predicate.
    • anySatisfy

      boolean anySatisfy​(CharPredicate predicate)
      Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false.
    • allSatisfy

      boolean allSatisfy​(CharPredicate predicate)
      Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.
    • noneSatisfy

      boolean noneSatisfy​(CharPredicate predicate)
      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

      Converts the CharIterable to a new MutableCharSet.
    • toBag

      Converts the CharIterable to a new MutableCharBag.
    • asLazy

      Returns a LazyCharIterable adapter wrapping the source CharIterable.
    • injectInto

      <T> T injectInto​(T injectedValue, ObjectCharToObjectFunction<? super T,​? extends T> function)
    • reduceIfEmpty

      default long reduceIfEmpty​(LongCharToLongFunction accumulator, long defaultValue)
      Since:
      10.0
      See Also:
      reduce(LongCharToLongFunction)
    • reduce

      default long reduce​(LongCharToLongFunction accumulator)
      Since:
      10.0
      See Also:
      RichIterable.reduce(BinaryOperator)
    • chunk

      default RichIterable<CharIterable> chunk​(int size)
      Partitions elements in fixed size chunks.
      Parameters:
      size - the number of elements per chunk
      Returns:
      A RichIterable containing CharIterables of size size, except the last will be truncated if the elements don't divide evenly.
      Since:
      9.2
    • sum

      long sum()
    • summaryStatistics

      default IntSummaryStatistics 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()