Class CharAdapter
- java.lang.Object
-
- org.eclipse.collections.impl.primitive.AbstractCharIterable
-
- org.eclipse.collections.impl.string.immutable.CharAdapter
-
- All Implemented Interfaces:
Serializable,CharSequence,CharIterable,ImmutableCharCollection,CharList,ImmutableCharList,OrderedCharIterable,ReversibleCharIterable,PrimitiveIterable
public class CharAdapter extends AbstractCharIterable implements CharSequence, ImmutableCharList, Serializable
Provides a view into the char[] stored in a String as an ImmutableCharList. This is a cleaner more OO way of providing many of the iterable protocols available in StringIterate for char values.- Since:
- 7.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CharAdapter(String value)
-
Method Summary
-
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractCharIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toSortedArray, toSortedList
-
Methods inherited from interface org.eclipse.collections.api.CharIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.CharList
forEachInBoth
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.ImmutableCharList
collectWithIndex, rejectWithIndex, selectWithIndex, tap
-
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedCharIterable
collectWithIndex, rejectWithIndex, selectWithIndex
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, notEmpty
-
-
-
-
Constructor Detail
-
CharAdapter
public CharAdapter(String value)
-
-
Method Detail
-
adapt
public static CharAdapter adapt(String value)
-
from
public static CharAdapter from(char... chars)
-
from
public static CharAdapter from(CharIterable iterable)
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
length
public int length()
- Specified by:
lengthin interfaceCharSequence
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacePrimitiveIterable
-
subSequence
public String subSequence(int start, int end)
- Specified by:
subSequencein interfaceCharSequence
-
toStringBuilder
public StringBuilder toStringBuilder()
-
toString
public String toString()
The value of toString must be strictly implemented as defined in CharSequence.- Specified by:
toStringin interfaceCharSequence- Specified by:
toStringin interfacePrimitiveIterable- Overrides:
toStringin classAbstractCharIterable
-
charIterator
public CharIterator charIterator()
- Specified by:
charIteratorin interfaceCharIterable
-
toArray
public char[] toArray()
- Specified by:
toArrayin interfaceCharIterable
-
toArray
public char[] toArray(char[] target)
- Specified by:
toArrayin interfaceCharIterable
-
contains
public boolean contains(char expected)
- Specified by:
containsin interfaceCharIterable
-
each
public void each(CharProcedure procedure)
- Specified by:
eachin interfaceCharIterable
-
distinct
public CharAdapter distinct()
- Specified by:
distinctin interfaceCharList- Specified by:
distinctin interfaceImmutableCharList- Specified by:
distinctin interfaceReversibleCharIterable
-
newWith
public CharAdapter newWith(char element)
- Specified by:
newWithin interfaceImmutableCharCollection- Specified by:
newWithin interfaceImmutableCharList
-
newWithout
public CharAdapter newWithout(char element)
- Specified by:
newWithoutin interfaceImmutableCharCollection- Specified by:
newWithoutin interfaceImmutableCharList
-
newWithAll
public CharAdapter newWithAll(CharIterable elements)
- Specified by:
newWithAllin interfaceImmutableCharCollection- Specified by:
newWithAllin interfaceImmutableCharList
-
newWithoutAll
public CharAdapter newWithoutAll(CharIterable elements)
- Specified by:
newWithoutAllin interfaceImmutableCharCollection- Specified by:
newWithoutAllin interfaceImmutableCharList
-
toReversed
public CharAdapter toReversed()
- Specified by:
toReversedin interfaceCharList- Specified by:
toReversedin interfaceImmutableCharList- Specified by:
toReversedin interfaceReversibleCharIterable
-
subList
public ImmutableCharList subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceCharList- Specified by:
subListin interfaceImmutableCharList
-
getCharacter
public Character getCharacter(int index)
-
dotProduct
public long dotProduct(CharList list)
- Specified by:
dotProductin interfaceCharList
-
binarySearch
public int binarySearch(char value)
- Specified by:
binarySearchin interfaceCharList
-
lastIndexOf
public int lastIndexOf(char value)
- Specified by:
lastIndexOfin interfaceCharList
-
toImmutable
public ImmutableCharList toImmutable()
- Specified by:
toImmutablein interfaceCharList
-
getLast
public char getLast()
- Specified by:
getLastin interfaceReversibleCharIterable
-
asReversed
public LazyCharIterable asReversed()
- Specified by:
asReversedin interfaceReversibleCharIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectCharIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndexin interfaceOrderedCharIterable- Specified by:
injectIntoWithIndexin interfaceReversibleCharIterable
-
getFirst
public char getFirst()
- Specified by:
getFirstin interfaceOrderedCharIterable
-
indexOf
public int indexOf(char value)
- Specified by:
indexOfin interfaceOrderedCharIterable
-
forEachWithIndex
public void forEachWithIndex(CharIntProcedure procedure)
- Specified by:
forEachWithIndexin interfaceOrderedCharIterable
-
select
public CharAdapter select(CharPredicate predicate)
- Specified by:
selectin interfaceCharIterable- Specified by:
selectin interfaceCharList- Specified by:
selectin interfaceImmutableCharCollection- Specified by:
selectin interfaceImmutableCharList- Specified by:
selectin interfaceOrderedCharIterable- Specified by:
selectin interfaceReversibleCharIterable
-
reject
public CharAdapter reject(CharPredicate predicate)
- Specified by:
rejectin interfaceCharIterable- Specified by:
rejectin interfaceCharList- Specified by:
rejectin interfaceImmutableCharCollection- Specified by:
rejectin interfaceImmutableCharList- Specified by:
rejectin interfaceOrderedCharIterable- Specified by:
rejectin interfaceReversibleCharIterable
-
collect
public <V> ImmutableList<V> collect(CharToObjectFunction<? extends V> function)
- Specified by:
collectin interfaceCharIterable- Specified by:
collectin interfaceCharList- Specified by:
collectin interfaceImmutableCharCollection- Specified by:
collectin interfaceImmutableCharList- Specified by:
collectin interfaceOrderedCharIterable- Specified by:
collectin interfaceReversibleCharIterable
-
collectChar
public CharAdapter collectChar(CharToCharFunction function)
-
detectIfNone
public char detectIfNone(CharPredicate predicate, char ifNone)
- Specified by:
detectIfNonein interfaceCharIterable
-
count
public int count(CharPredicate predicate)
- Specified by:
countin interfaceCharIterable
-
anySatisfy
public boolean anySatisfy(CharPredicate predicate)
- Specified by:
anySatisfyin interfaceCharIterable
-
allSatisfy
public boolean allSatisfy(CharPredicate predicate)
- Specified by:
allSatisfyin interfaceCharIterable
-
noneSatisfy
public boolean noneSatisfy(CharPredicate predicate)
- Specified by:
noneSatisfyin interfaceCharIterable
-
toList
public MutableCharList toList()
- Specified by:
toListin interfaceCharIterable- Overrides:
toListin classAbstractCharIterable
-
toSet
public MutableCharSet toSet()
- Specified by:
toSetin interfaceCharIterable- Overrides:
toSetin classAbstractCharIterable
-
toBag
public MutableCharBag toBag()
- Specified by:
toBagin interfaceCharIterable- Overrides:
toBagin classAbstractCharIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceCharIterable
-
chunk
public RichIterable<CharIterable> chunk(int size)
- Specified by:
chunkin interfaceCharIterable
-
sum
public long sum()
- Specified by:
sumin interfaceCharIterable
-
max
public char max()
- Specified by:
maxin interfaceCharIterable
-
min
public char min()
- Specified by:
minin interfaceCharIterable
-
size
public int size()
- Specified by:
sizein interfacePrimitiveIterable
-
appendString
public void appendString(Appendable appendable, String start, String separator, String end)
- Specified by:
appendStringin interfacePrimitiveIterable
-
equals
public boolean equals(Object otherList)
-
hashCode
public int hashCode()
-
zipChar
public ImmutableList<CharCharPair> zipChar(CharIterable iterable)
- Specified by:
zipCharin interfaceCharList- Specified by:
zipCharin interfaceImmutableCharList- Since:
- 9.1.
-
zip
public <T> ImmutableList<CharObjectPair<T>> zip(Iterable<T> iterable)
- Specified by:
zipin interfaceCharList- Specified by:
zipin interfaceImmutableCharList- Since:
- 9.1.
-
-