Class CharArrayList
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractCharIterable
org.eclipse.collections.impl.list.mutable.primitive.CharArrayList
- All Implemented Interfaces:
Externalizable
,Serializable
,CharIterable
,MutableCharCollection
,CharList
,MutableCharList
,OrderedCharIterable
,ReversibleCharIterable
,PrimitiveIterable
public class CharArrayList extends AbstractCharIterable implements MutableCharList, Externalizable
CharArrayList is similar to
FastList
, and is memory-optimized for char primitives.
This file was automatically generated from template file primitiveArrayList.stg.- Since:
- 3.0.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CharArrayList()
CharArrayList(char... array)
CharArrayList(int initialCapacity)
-
Method Summary
Modifier and Type Method Description boolean
add(char newItem)
boolean
addAll(char... source)
boolean
addAll(CharIterable source)
boolean
addAllAtIndex(int index, char... source)
boolean
addAllAtIndex(int index, CharIterable source)
void
addAtIndex(int index, char element)
boolean
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.void
appendString(Appendable appendable, String start, String separator, String end)
Prints a string representation of this collection onto the givenAppendable
.LazyCharIterable
asReversed()
MutableCharList
asSynchronized()
MutableCharList
asUnmodifiable()
int
binarySearch(char value)
MutableCharIterator
charIterator()
Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.RichIterable<CharIterable>
chunk(int size)
Partitions elements in fixed size chunks.void
clear()
<V> MutableList<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.<V, R extends Collection<V>>
Rcollect(CharToObjectFunction<? extends V> function, R target)
Same asCharIterable.collect(CharToObjectFunction)
, only the results are added to the target Collection.boolean
contains(char value)
Returns true if the value is contained in the CharIterable, and false if it is not.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)
MutableCharList
distinct()
long
dotProduct(CharList list)
void
each(CharProcedure procedure)
A synonym for forEach.void
ensureCapacity(int minCapacity)
boolean
equals(Object otherList)
Follows the same general contract asList.equals(Object)
.void
forEach(CharProcedure procedure)
Applies the CharProcedure to each element in the CharIterable.void
forEachWithIndex(CharIntProcedure procedure)
char
get(int index)
char
getFirst()
char
getLast()
int
hashCode()
Follows the same general contract asList.hashCode()
.int
indexOf(char value)
<T> T
injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)
<T> T
injectIntoWithIndex(T injectedValue, ObjectCharIntToObjectFunction<? super T,? extends T> function)
int
lastIndexOf(char value)
char
max()
char
min()
CharArrayList
newEmpty()
Creates a new empty CharArrayList.static CharArrayList
newList(CharIterable source)
static CharArrayList
newListWith(char... elements)
Creates a new list using the passedelements
argument as the backing store.static CharArrayList
newWithNValues(int size, char value)
boolean
noneSatisfy(CharPredicate predicate)
Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.void
readExternal(ObjectInput in)
CharArrayList
reject(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.<R extends MutableCharCollection>
Rreject(CharPredicate predicate, R target)
Same asCharIterable.reject(CharPredicate)
, only the results are added to the target MutableCharCollection.boolean
remove(char value)
boolean
removeAll(char... source)
boolean
removeAll(CharIterable source)
char
removeAtIndex(int index)
boolean
removeIf(CharPredicate predicate)
boolean
retainAll(char... source)
boolean
retainAll(CharIterable source)
CharArrayList
reverseThis()
CharArrayList
select(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.<R extends MutableCharCollection>
Rselect(CharPredicate predicate, R target)
Same asCharIterable.select(CharPredicate)
, only the results are added to the target MutableCharCollection.char
set(int index, char element)
int
size()
Returns the number of items in this iterable.CharArrayList
sortThis()
Sorts this list mutating its contents and returns the same mutable list (this).CharArrayList
sortThis(CharComparator comparator)
Sorts the internal data structure of this list and returns the list itself as a convenience.MutableCharList
subList(int fromIndex, int toIndex)
long
sum()
void
swap(int index1, int index2)
char[]
toArray()
Converts the CharIterable to a primitive char array.char[]
toArray(char[] target)
Converts the CharIterable to a primitive char array.ImmutableCharList
toImmutable()
Returns an immutable copy of this list.CharArrayList
toReversed()
void
trimToSize()
CharArrayList
with(char element)
CharArrayList
with(char element1, char element2)
CharArrayList
with(char element1, char element2, char element3)
CharArrayList
with(char element1, char element2, char element3, char... elements)
CharArrayList
withAll(CharIterable elements)
CharArrayList
without(char element)
CharArrayList
withoutAll(CharIterable elements)
static CharArrayList
wrapCopy(char... array)
Creates a new list by first copying the array passed in.void
writeExternal(ObjectOutput out)
<T> MutableList<CharObjectPair<T>>
zip(Iterable<T> iterable)
Returns aMutableList
formed from thisMutableCharList
and aListIterable
by combining corresponding elements in pairs.MutableList<CharCharPair>
zipChar(CharIterable iterable)
Returns aMutableList
formed from thisMutableCharList
and anotherCharList
by combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractCharIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
Methods inherited from interface org.eclipse.collections.api.CharIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableCharList
collectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tap
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedCharIterable
collectWithIndex
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
CharArrayList
public CharArrayList() -
CharArrayList
public CharArrayList(int initialCapacity) -
CharArrayList
public CharArrayList(char... array)
-
-
Method Details
-
newListWith
Creates a new list using the passedelements
argument as the backing store.!!! WARNING: This method uses the passed in array, so can be very unsafe if the original array is held onto anywhere else. !!!
-
newList
-
newWithNValues
-
wrapCopy
Creates a new list by first copying the array passed in. -
size
public int size()Description copied from interface:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
clear
public void clear()- Specified by:
clear
in interfaceMutableCharCollection
-
contains
public boolean contains(char value)Description copied from interface:CharIterable
Returns true if the value is contained in the CharIterable, and false if it is not.- Specified by:
contains
in interfaceCharIterable
-
get
public char get(int index) -
getFirst
public char getFirst()- Specified by:
getFirst
in interfaceOrderedCharIterable
-
getLast
public char getLast()- Specified by:
getLast
in interfaceReversibleCharIterable
-
indexOf
public int indexOf(char value)- Specified by:
indexOf
in interfaceOrderedCharIterable
-
lastIndexOf
public int lastIndexOf(char value)- Specified by:
lastIndexOf
in interfaceCharList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(char newItem)- Specified by:
add
in interfaceMutableCharCollection
-
addAll
public boolean addAll(char... source)- Specified by:
addAll
in interfaceMutableCharCollection
-
addAll
- Specified by:
addAll
in interfaceMutableCharCollection
-
addAtIndex
public void addAtIndex(int index, char element)- Specified by:
addAtIndex
in interfaceMutableCharList
-
addAllAtIndex
public boolean addAllAtIndex(int index, char... source)- Specified by:
addAllAtIndex
in interfaceMutableCharList
-
addAllAtIndex
- Specified by:
addAllAtIndex
in interfaceMutableCharList
-
remove
public boolean remove(char value)- Specified by:
remove
in interfaceMutableCharCollection
-
removeIf
- Specified by:
removeIf
in interfaceMutableCharCollection
-
removeAll
- Specified by:
removeAll
in interfaceMutableCharCollection
-
removeAll
public boolean removeAll(char... source)- Specified by:
removeAll
in interfaceMutableCharCollection
-
retainAll
- Specified by:
retainAll
in interfaceMutableCharCollection
- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(char... source)- Specified by:
retainAll
in interfaceMutableCharCollection
- See Also:
Collection.retainAll(Collection)
-
removeAtIndex
public char removeAtIndex(int index)- Specified by:
removeAtIndex
in interfaceMutableCharList
-
set
public char set(int index, char element)- Specified by:
set
in interfaceMutableCharList
-
swap
public void swap(int index1, int index2)- Specified by:
swap
in interfaceMutableCharList
-
with
- Specified by:
with
in interfaceMutableCharCollection
- Specified by:
with
in interfaceMutableCharList
-
without
- Specified by:
without
in interfaceMutableCharCollection
- Specified by:
without
in interfaceMutableCharList
-
withAll
- Specified by:
withAll
in interfaceMutableCharCollection
- Specified by:
withAll
in interfaceMutableCharList
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableCharCollection
- Specified by:
withoutAll
in interfaceMutableCharList
-
with
-
with
-
with
-
charIterator
Description copied from interface:CharIterable
Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.- Specified by:
charIterator
in interfaceCharIterable
- Specified by:
charIterator
in interfaceMutableCharCollection
-
forEach
Description copied from interface:CharIterable
Applies the CharProcedure to each element in the CharIterable.- Specified by:
forEach
in interfaceCharIterable
-
each
Description copied from interface:CharIterable
A synonym for forEach.- Specified by:
each
in interfaceCharIterable
- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndex
in interfaceOrderedCharIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)- Specified by:
injectInto
in interfaceCharIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectCharIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndex
in interfaceOrderedCharIterable
- Specified by:
injectIntoWithIndex
in interfaceReversibleCharIterable
-
chunk
Description copied from interface:CharIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceCharIterable
- 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.
-
count
Description copied from interface:CharIterable
Returns a count of the number of elements in the CharIterable that return true for the specified predicate.- Specified by:
count
in interfaceCharIterable
-
anySatisfy
Description copied from interface:CharIterable
Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceCharIterable
-
allSatisfy
Description copied from interface:CharIterable
Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceCharIterable
-
noneSatisfy
Description copied from interface:CharIterable
Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceCharIterable
-
select
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.- Specified by:
select
in interfaceCharIterable
- Specified by:
select
in interfaceCharList
- Specified by:
select
in interfaceMutableCharCollection
- Specified by:
select
in interfaceMutableCharList
- Specified by:
select
in interfaceOrderedCharIterable
- Specified by:
select
in interfaceReversibleCharIterable
-
select
Description copied from interface:CharIterable
Same asCharIterable.select(CharPredicate)
, only the results are added to the target MutableCharCollection.- Specified by:
select
in interfaceCharIterable
- Since:
- 8.1.
-
reject
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.- Specified by:
reject
in interfaceCharIterable
- Specified by:
reject
in interfaceCharList
- Specified by:
reject
in interfaceMutableCharCollection
- Specified by:
reject
in interfaceMutableCharList
- Specified by:
reject
in interfaceOrderedCharIterable
- Specified by:
reject
in interfaceReversibleCharIterable
-
reject
Description copied from interface:CharIterable
Same asCharIterable.reject(CharPredicate)
, only the results are added to the target MutableCharCollection.- Specified by:
reject
in interfaceCharIterable
- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNone
in interfaceCharIterable
-
collect
Description copied from interface:CharIterable
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.- Specified by:
collect
in interfaceCharIterable
- Specified by:
collect
in interfaceCharList
- Specified by:
collect
in interfaceMutableCharCollection
- Specified by:
collect
in interfaceMutableCharList
- Specified by:
collect
in interfaceOrderedCharIterable
- Specified by:
collect
in interfaceReversibleCharIterable
-
collect
public <V, R extends Collection<V>> R collect(CharToObjectFunction<? extends V> function, R target)Description copied from interface:CharIterable
Same asCharIterable.collect(CharToObjectFunction)
, only the results are added to the target Collection.- Specified by:
collect
in interfaceCharIterable
- Since:
- 8.1.
-
max
public char max()- Specified by:
max
in interfaceCharIterable
-
min
public char min()- Specified by:
min
in interfaceCharIterable
-
sum
public long sum()- Specified by:
sum
in interfaceCharIterable
-
dotProduct
- Specified by:
dotProduct
in interfaceCharList
-
toArray
public char[] toArray()Description copied from interface:CharIterable
Converts the CharIterable to a primitive char array.- Specified by:
toArray
in interfaceCharIterable
-
toArray
public char[] toArray(char[] target)Description copied from interface:CharIterable
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.- Specified by:
toArray
in interfaceCharIterable
-
equals
Description copied from interface:CharList
Follows the same general contract asList.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:CharList
Follows the same general contract asList.hashCode()
. -
appendString
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableCharCollection
- Specified by:
asUnmodifiable
in interfaceMutableCharList
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableCharCollection
- Specified by:
asSynchronized
in interfaceMutableCharList
-
toImmutable
Description copied from interface:MutableCharList
Returns an immutable copy of this list.- Specified by:
toImmutable
in interfaceCharList
- Specified by:
toImmutable
in interfaceMutableCharCollection
- Specified by:
toImmutable
in interfaceMutableCharList
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
asReversed
- Specified by:
asReversed
in interfaceReversibleCharIterable
-
reverseThis
- Specified by:
reverseThis
in interfaceMutableCharList
-
sortThis
Description copied from interface:MutableCharList
Sorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThis
in interfaceMutableCharList
-
sortThis
Description copied from interface:MutableCharList
Sorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThis
in interfaceMutableCharList
-
toReversed
- Specified by:
toReversed
in interfaceCharList
- Specified by:
toReversed
in interfaceMutableCharList
- Specified by:
toReversed
in interfaceReversibleCharIterable
-
binarySearch
public int binarySearch(char value)- Specified by:
binarySearch
in interfaceCharList
-
distinct
- Specified by:
distinct
in interfaceCharList
- Specified by:
distinct
in interfaceMutableCharList
- Specified by:
distinct
in interfaceReversibleCharIterable
-
subList
- Specified by:
subList
in interfaceCharList
- Specified by:
subList
in interfaceMutableCharList
- See Also:
List.subList(int fromIndex, int toIndex)
-
zipChar
Description copied from interface:MutableCharList
Returns aMutableList
formed from thisMutableCharList
and anotherCharList
by combining corresponding elements in pairs. If one of the twoCharList
s is longer than the other, its remaining elements are ignored.- Specified by:
zipChar
in interfaceCharList
- Specified by:
zipChar
in interfaceMutableCharList
- Since:
- 9.1.
-
newEmpty
Creates a new empty CharArrayList.- Specified by:
newEmpty
in interfaceMutableCharCollection
- Specified by:
newEmpty
in interfaceMutableCharList
- Since:
- 9.2.
-
zip
Description copied from interface:MutableCharList
Returns aMutableList
formed from thisMutableCharList
and aListIterable
by combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zip
in interfaceCharList
- Specified by:
zip
in interfaceMutableCharList
- Since:
- 9.1.
-