public abstract class ICharList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.lang.CharSequence
List,
Deque,
ArrayList,
LinkedList,
Serialized Form| Constructor and Description |
|---|
ICharList() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(char elem) |
void |
add(int index,
char elem) |
boolean |
addAll(java.util.Collection<java.lang.Character> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(ICharList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(int index,
java.util.Collection<java.lang.Character> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addAll(int index,
ICharList list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
boolean |
addArray(char... elems)
Adds all specified elements into this list.
|
boolean |
addArray(char[] elems,
int offset,
int length) |
boolean |
addArray(int index,
char... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addArray(int index,
char[] elems,
int offset,
int length) |
void |
addFirst(char elem) |
boolean |
addIfAbsent(char elem)
Add elements if it is not already contained in the list.
|
void |
addLast(char elem) |
boolean |
addMult(int len,
char elem)
Adds element multiple time to list.
|
boolean |
addMult(int index,
int len,
char elem)
Inserts element multiple time to list, starting at the specified position.
|
int |
binarySearch(char key)
Searches the specified range for an object using the binary
search algorithm.
|
abstract int |
binarySearch(int index,
int len,
char key)
Searches the specified range for an object using the binary
search algorithm.
|
abstract int |
capacity()
Returns capacity of this list.
|
char |
charAt(int index) |
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this list instance.
|
boolean |
contains(char elem) |
boolean |
containsAll(java.util.Collection<java.lang.Character> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Character> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
boolean |
containsIf(java.util.function.Predicate<java.lang.Character> predicate)
Determines whether the list contains a matching element.
|
ICharList |
copy()
Returns a shallow copy of this list instance.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
void |
drag(int srcIndex,
int dstIndex,
int len)
Drag specified elements.
|
char |
element() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this GapList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
boolean |
equals(java.lang.Object obj) |
ICharList |
extract(int index,
int len)
Removes specified range of elements from list and return them.
|
ICharList |
extractIf(java.util.function.Predicate<java.lang.Character> predicate)
Removes and returns all elements in the list which match the predicate.
|
void |
fill(char elem)
Fill list.
|
void |
filter(java.util.function.Predicate<java.lang.Character> predicate)
Filter the list using the specified predicate.
|
ICharList |
filteredList(java.util.function.Predicate<java.lang.Character> predicate)
Create a new list by applying the specified filter to all elements.
|
char |
get(int index) |
ICharList |
getAll(char elem)
Returns all elements in the list equal to the specified element.
|
ICharList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
int |
getCount(char elem)
Counts how many times the specified element is contained in the list.
|
java.util.Set |
getDistinct()
Returns distinct elements in the list.
|
char |
getFirst() |
ICharList |
getIf(java.util.function.Predicate predicate)
Returns all elements in the list which match the predicate.
|
char |
getLast() |
char |
getSingle()
Returns the only element stored in the list.
|
char |
getSingleOrEmpty()
Returns the only element stored in the list or null if the list is empty.
|
int |
hashCode() |
int |
indexOf(char elem) |
int |
indexOf(char elem,
int fromIndex)
Returns the index of the first occurrence of the specified element in this list, starting the search at the specified position.
|
int |
indexOfIf(java.util.function.Predicate<java.lang.Character> predicate)
Returns the index of the first element which matches the specified element in this list.
|
void |
initAll(java.util.Collection<java.lang.Character> coll)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initAll(ICharList list)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initArray(char... elems)
Initializes the list so it will afterwards only contain the elements of the array.
|
void |
initMult(int len,
char elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(char elem) |
int |
lastIndexOf(char elem,
int fromIndex)
Returns the index of the last occurrence of the specified element in this list, starting the search at the specified position.
|
int |
length() |
<R> IList<R> |
mappedList(java.util.function.Function<java.lang.Character,R> func)
Create a new list by applying the specified mapping function to all elements.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(char elem) |
boolean |
offerFirst(char elem) |
boolean |
offerLast(char elem) |
char |
peek() |
char |
peekFirst() |
char |
peekLast() |
char |
poll() |
char |
pollFirst() |
char |
pollLast() |
char |
pop() |
void |
push(char elem) |
char |
put(int index,
char elem)
Sets or adds the element.
|
void |
putAll(int index,
java.util.Collection<java.lang.Character> coll)
Set or add the specified elements.
|
void |
putAll(int index,
ICharList list)
Set or add the specified elements.
|
void |
putArray(int index,
char... elems)
Set or add the specified elements.
|
void |
putMult(int index,
int len,
char elem)
Set or add the specified element multiple times.
|
char |
remove() |
char |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
ICharList |
removeAll(char elem)
Removes all equal elements.
|
boolean |
removeAll(java.util.Collection<java.lang.Character> coll) |
boolean |
removeAll(ICharList coll) |
boolean |
removeElem(char elem) |
char |
removeFirst() |
boolean |
removeFirstOccurrence(char elem) |
boolean |
removeIf(java.util.function.Predicate<java.lang.Character> predicate)
Removes all elements in the list which match the predicate.
|
char |
removeLast() |
boolean |
removeLastOccurrence(char elem) |
void |
replaceAll(int index,
int len,
java.util.Collection<java.lang.Character> coll)
Replaces the specified range with new elements.
|
void |
replaceAll(int index,
int len,
ICharList list)
Replaces the specified range with new elements.
|
void |
replaceArray(int index,
int len,
char... elems)
Replaces the specified range with new elements.
|
void |
replaceMult(int index,
int len,
int numElems,
char elem)
Replaces the specified range with new elements.
|
void |
resize(int len,
char elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(java.util.Collection<java.lang.Character> coll) |
boolean |
retainAll(ICharList coll) |
boolean |
retainIf(java.util.function.Predicate<java.lang.Character> predicate)
Retains all elements in the list which match the predicate.
|
void |
reverse()
Reverses the order of all elements in the specified list.
|
void |
reverse(int index,
int len)
Reverses the order of the specified elements in the list.
|
void |
rotate(int distance)
Rotate specified elements in the list.
|
void |
rotate(int index,
int len,
int distance)
Rotate specified elements in the list.
|
char |
set(int index,
char elem) |
void |
setAll(int index,
java.util.Collection<java.lang.Character> coll)
Sets the specified elements.
|
void |
setAll(int index,
ICharList list)
Sets the specified elements.
|
void |
setArray(int index,
char... elems)
Sets the specified elements.
|
void |
setArray(int index,
char[] elems,
int offset,
int length) |
void |
setMult(int index,
int len,
char elem)
Sets the element multiple times.
|
abstract int |
size() |
void |
sort()
Sort elements in the list using the specified comparator.
|
abstract void |
sort(int index,
int len)
Sort specified elements in the list using the specified comparator.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
char[] |
toArray() |
char[] |
toArray(char[] array) |
char[] |
toArray(char[] array,
int index,
int len)
Returns an array containing the specified elements in this list.
|
char[] |
toArray(java.lang.Class clazz)
Returns an array containing the elements in this list.
|
char[] |
toArray(java.lang.Class clazz,
int index,
int len)
Returns an array containing the specified elements in this list.
|
char[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
java.lang.String |
toString() |
static void |
transferCopy(ICharList src,
int srcIndex,
int srcLen,
ICharList dst,
int dstIndex,
int dstLen)
Copies elements from one list to another.
|
static void |
transferMove(ICharList src,
int srcIndex,
int srcLen,
ICharList dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by setting it to null in the source list.
|
static void |
transferRemove(ICharList src,
int srcIndex,
int srcLen,
ICharList dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by removing it from the source list.
|
static void |
transferSwap(ICharList src,
int srcIndex,
ICharList dst,
int dstIndex,
int len)
Swaps elements from two lists.
|
void |
transform(java.util.function.UnaryOperator<java.lang.Character> op)
Change the list by applying the specified operator to all elements.
|
ICharList |
transformedList(java.util.function.UnaryOperator<java.lang.Character> op)
Create a new list by applying the specified transforming operator to all elements.
|
abstract void |
trimToSize()
An application can use this operation to minimize the storage of an instance.
|
abstract ICharList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public ICharList copy()
clone()public abstract ICharList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void clear()
public void resize(int len,
char elem)
len. If the list must grow, the specified
element elem will be used for filling.len - length of listelem - element which will be used for extending the listjava.lang.IndexOutOfBoundsException - if the range is invalidpublic abstract int size()
public abstract int capacity()
public char get(int index)
public char set(int index,
char elem)
public char put(int index,
char elem)
index - index where element will be placedelem - element to putpublic boolean add(char elem)
public void add(int index,
char elem)
public char remove(int index)
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic abstract void trimToSize()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic boolean isEmpty()
public int getCount(char elem)
elem - element to countpublic char getSingle()
NoSuchElementException is thrown.public char getSingleOrEmpty()
NoSuchElementException is thrown.public ICharList getAll(char elem)
elem - element to look forpublic ICharList getIf(java.util.function.Predicate predicate)
predicate - predicatepublic boolean removeIf(java.util.function.Predicate<java.lang.Character> predicate)
predicate - a predicate which returns true for elements to be removedtrue if any elements were removedpublic boolean retainIf(java.util.function.Predicate<java.lang.Character> predicate)
predicate - a predicate which returns true for elements to be retainedtrue if any elements were removedpublic ICharList extractIf(java.util.function.Predicate<java.lang.Character> predicate)
predicate - predicatepublic java.util.Set getDistinct()
public <R> IList<R> mappedList(java.util.function.Function<java.lang.Character,R> func)
func - mapping functionpublic ICharList transformedList(java.util.function.UnaryOperator<java.lang.Character> op)
op - transforming operatorpublic void transform(java.util.function.UnaryOperator<java.lang.Character> op)
op - transforming operatorpublic ICharList filteredList(java.util.function.Predicate<java.lang.Character> predicate)
predicate - predicate used for filteringpublic void filter(java.util.function.Predicate<java.lang.Character> predicate)
predicate - predicate used for filteringpublic int indexOf(char elem)
public int indexOfIf(java.util.function.Predicate<java.lang.Character> predicate)
predicate - predicate used to search element#indexOf(Object)public int lastIndexOf(char elem)
public int indexOf(char elem,
int fromIndex)
elem - element to search forfromIndex - start index for search#indexOf(Object)public int lastIndexOf(char elem,
int fromIndex)
elem - element to search forfromIndex - start index for search#lastIndexOf(Object)public boolean removeElem(char elem)
public boolean contains(char elem)
public boolean containsIf(java.util.function.Predicate<java.lang.Character> predicate)
predicate - predicate used to search elementpublic boolean addIfAbsent(char elem)
elem - element to addpublic boolean containsAny(java.util.Collection<java.lang.Character> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Character> coll)
public ICharList removeAll(char elem)
elem - elementpublic boolean removeAll(java.util.Collection<java.lang.Character> coll)
public boolean removeAll(ICharList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Character> coll)
public boolean retainAll(ICharList coll)
retainAll(Collection)public char[] toArray()
public char[] toArray(char[] array)
public char[] toArray(java.lang.Class clazz)
clazz - class for array elementspublic char[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copyList.toArray()public char[] toArray(char[] array,
int index,
int len)
array - the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purposeindex - index of first element to copylen - number of elements to copyList.toArray(Object[])public char[] toArray(java.lang.Class clazz,
int index,
int len)
clazz - class for array elementsindex - index of first element to copylen - number of elements to copypublic char peek()
public char element()
public char poll()
public char remove()
public boolean offer(char elem)
public char getFirst()
public char getLast()
public void addFirst(char elem)
public void addLast(char elem)
public char removeFirst()
public char removeLast()
public boolean offerFirst(char elem)
public boolean offerLast(char elem)
public char peekFirst()
public char peekLast()
public char pollFirst()
public char pollLast()
public char pop()
public void push(char elem)
public boolean removeFirstOccurrence(char elem)
public boolean removeLastOccurrence(char elem)
public static void transferCopy(ICharList src, int srcIndex, int srcLen, ICharList dst, int dstIndex, int dstLen)
copy(int, int, int).src - source listsrcIndex - index of first element in source listsrcLen - number of elements to copydst - destination listdstIndex - index of first element in destination listdstLen - number of elements to replace in destination listtype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void transferMove(ICharList src, int srcIndex, int srcLen, ICharList dst, int dstIndex, int dstLen)
move(int, int, int).src - source listsrcIndex - index of first element in source listsrcLen - number of elements to copydst - destination listdstIndex - index of first element in destination listdstLen - number of elements to replace in destination listtype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void transferRemove(ICharList src, int srcIndex, int srcLen, ICharList dst, int dstIndex, int dstLen)
drag(int, int, int).src - source listsrcIndex - index of first element in source listsrcLen - number of elements to copydst - destination listdstIndex - index of first element in destination listdstLen - number of elements to replace in destination listtype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void transferSwap(ICharList src, int srcIndex, ICharList dst, int dstIndex, int len)
swap(int, int, int).src - first listsrcIndex - index of first element in first listdst - second listdstIndex - index of first element in second listlen - number of elements to swaptype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic ICharList getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic ICharList extract(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic void remove(int index,
int len)
index - index of first element to removelen - number of elements to removejava.lang.IndexOutOfBoundsException - if the range is invalidpublic boolean addAll(ICharList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is nullpublic boolean addAll(int index,
ICharList list)
index - index at which to insert the first element from the
specified collectionlist - list containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(java.util.Collection<java.lang.Character> coll)
coll - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
java.util.Collection<java.lang.Character> coll)
index - index at which to insert the first element from the
specified collectioncoll - collection containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is nullpublic boolean addArray(char... elems)
elems - elements to be added to this listpublic boolean addArray(char[] elems,
int offset,
int length)
public boolean addArray(int index,
char[] elems,
int offset,
int length)
public boolean addArray(int index,
char... elems)
index - index at which to insert the first element from the
specified collectionelems - elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean addMult(int len,
char elem)
elem - element to be added to this listpublic boolean addMult(int index,
int len,
char elem)
index - index at which to insert the first element from the
specified collectionelem - element to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidpublic void setAll(int index,
ICharList list)
index - index of first element to setlist - list with elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void setAll(int index,
java.util.Collection<java.lang.Character> coll)
index - index of first element to setcoll - collection with elements to setpublic void setArray(int index,
char... elems)
index - index of first element to setelems - array with elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void setArray(int index,
char[] elems,
int offset,
int length)
public void setMult(int index,
int len,
char elem)
index - index of first element to setelem - element to setpublic void putAll(int index,
ICharList list)
index - index of first element to set or addlist - list with elements to set or addpublic void putAll(int index,
java.util.Collection<java.lang.Character> coll)
index - index of first element to set or addcoll - collection with elements to set or addpublic void putArray(int index,
char... elems)
index - index of first element to set or addelems - array with elements to set or addpublic void putMult(int index,
int len,
char elem)
index - index of first element to set or addlen - element to set or addpublic void initAll(ICharList list)
list - list with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initAll(java.util.Collection<java.lang.Character> coll)
coll - collection with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initArray(char... elems)
elems - array with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initMult(int len,
char elem)
len and contain only the element elem.
The list will grow or shrink as needed.len - length of listelem - element which the list will containjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void replaceAll(int index,
int len,
java.util.Collection<java.lang.Character> coll)
index - index of first element to replace, use -1 for the position after the last element (this.size())len - number of elements to replace, use -1 for getting behavior of putAll()coll - collection with elements which replace the old elements, use null if elements should only be removedjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void replaceArray(int index,
int len,
char... elems)
index - index of first element to replace, use -1 for the position after the last element (this.size())len - number of elements to replace, use -1 for getting behavior of putAll()elems - array with elements which replace the old elements, use null if elements should only be removedjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void replaceMult(int index,
int len,
int numElems,
char elem)
index - index of first element to replace, use -1 for the position after the last element (this.size())len - number of elements to replace, use -1 for getting behavior of putAll()numElems - number of time element has to be addedelem - element to addjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void replaceAll(int index,
int len,
ICharList list)
index - index of first element to replace, use -1 for the position after the last element (this.size())len - number of elements to replace, use -1 for getting behavior of putAll()list - list with elements which replace the old elements, use null if elements should only be removedjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void fill(char elem)
elem - element used for fillingpublic void copy(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to copydstIndex - index of first destination element to copylen - number of elements to copyjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void move(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to movedstIndex - index of first destination element to movelen - number of elements to movejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void drag(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to movedstIndex - index of first destination element to movelen - number of elements to movejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void swap(int index1,
int index2,
int len)
index1 - index of first element in first range to swapindex2 - index of first element in second range to swaplen - number of elements to swapjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void reverse()
public void reverse(int index,
int len)
index - index of first element to reverselen - number of elements to reversejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void rotate(int distance)
distance - distance to move the elementspublic void rotate(int index,
int len,
int distance)
index - index of first element to rotatelen - number of elements to rotatedistance - distance to move the elementsjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void sort()
comparator - comparator to use for sorting
(null means the elements natural ordering should be used)Arrays.sort(int[])public abstract void sort(int index,
int len)
index - index of first element to sortlen - number of elements to sortcomparator - comparator to use for sorting
(null means the elements natural ordering should be used)java.lang.IndexOutOfBoundsException - if the range is invalidArrays.sort(int[])public int binarySearch(char key)
key - the value to be searched forcomparator - the comparator by which the list is ordered.
A null value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public abstract int binarySearch(int index,
int len,
char key)
index - index of first element to searchlen - number of elements to searchkey - the value to be searched forcomparator - the comparator by which the list is ordered.
A null value indicates that the elements'
natural ordering should be used.java.lang.IndexOutOfBoundsException - if the range is invalidArrays.binarySearch(long[], long)public int length()
length in interface java.lang.CharSequencepublic char charAt(int index)
charAt in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequence