E - type of elements stored in the listpublic abstract class IList<E>
extends java.util.AbstractList<E>
implements java.util.List<E>, java.util.RandomAccess, java.lang.Cloneable, java.io.Serializable, java.util.Deque<E>
List,
Deque,
ArrayList,
LinkedList,
Serialized Form| Constructor and Description |
|---|
IList() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E elem) |
void |
add(int index,
E elem) |
boolean |
addAll(java.util.Collection<? extends E> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(IList<? extends E> list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(int index,
java.util.Collection<? extends E> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addAll(int index,
IList<? extends E> list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
boolean |
addArray(E... elems)
Adds all specified elements into this list.
|
boolean |
addArray(int index,
E... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
void |
addFirst(E elem) |
boolean |
addIfAbsent(E elem)
Add elements if it is not already contained in the list.
|
void |
addLast(E elem) |
boolean |
addMult(int len,
E elem)
Adds element multiple time to list.
|
boolean |
addMult(int index,
int len,
E elem)
Inserts element multiple time to list, starting at the specified position.
|
abstract <K> int |
binarySearch(int index,
int len,
K key,
java.util.Comparator<? super K> comparator)
Searches the specified range for an object using the binary
search algorithm.
|
<K> int |
binarySearch(K key,
java.util.Comparator<? super K> comparator)
Searches the specified range for an object using the binary
search algorithm.
|
abstract int |
capacity()
Returns capacity of this list.
|
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this list instance.
|
boolean |
contains(java.lang.Object elem) |
boolean |
containsAll(java.util.Collection<?> coll) |
boolean |
containsAny(java.util.Collection<?> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
IList<E> |
copy()
Returns a shallow copy of this list instance.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
java.util.Iterator<E> |
descendingIterator() |
void |
drag(int srcIndex,
int dstIndex,
int len)
Drag specified elements.
|
E |
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) |
IList<E> |
extract(int index,
int len)
Removes specified range of elements from list and return them.
|
IList<E> |
extractWhere(IPredicate<E> predicate)
Removes and returns all elements in the list which match the predicate.
|
void |
fill(E elem)
Fill list.
|
void |
filter(IPredicate<? super E> predicate)
Filter the list using the specified predicate.
|
E |
get(int index) |
IList<E> |
getAll(E elem)
Returns all elements in the list equal to the specified element.
|
IList<E> |
getAll(int index,
int len)
Returns specified range of elements from list.
|
E[] |
getArray(int index,
int len)
Returns specified range of elements from list as array.
|
int |
getCount(E elem)
Counts how many times the specified element is contained in the list.
|
java.util.Set<E> |
getDistinct()
Returns distinct elements in the list.
|
E |
getFirst() |
E |
getLast() |
IList<E> |
getWhere(IPredicate<E> predicate)
Returns all elements in the list which match the predicate.
|
int |
hashCode() |
int |
indexOf(java.lang.Object elem) |
int |
indexOf(java.lang.Object elem,
int fromIndex)
Returns the index of the first occurrence of the specified element in this list, starting the search at the specified position.
|
void |
initAll(java.util.Collection<? extends E> coll)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initAll(IList<? extends E> list)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initArray(E... elems)
Initializes the list so it will afterwards only contain the elements of the array.
|
void |
initMult(int len,
E elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object elem) |
int |
lastIndexOf(java.lang.Object elem,
int fromIndex)
Returns the index of the last occurrence of the specified element in this list, starting the search at the specified position.
|
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
<R> IList<R> |
mappedList(IFunction<E,R> mapper)
Create a new list by applying the specified mapper to all elements.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(E elem) |
boolean |
offerFirst(E elem) |
boolean |
offerLast(E elem) |
E |
peek() |
E |
peekFirst() |
E |
peekLast() |
E |
poll() |
E |
pollFirst() |
E |
pollLast() |
E |
pop() |
void |
push(E elem) |
E |
put(int index,
E elem)
Sets or adds the element.
|
void |
putAll(int index,
java.util.Collection<? extends E> coll)
Set or add the specified elements.
|
void |
putAll(int index,
IList<? extends E> list)
Set or add the specified elements.
|
void |
putArray(int index,
E... elems)
Set or add the specified elements.
|
void |
putMult(int index,
int len,
E elem)
Set or add the specified element multiple times.
|
E |
remove() |
E |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
boolean |
remove(java.lang.Object elem) |
boolean |
removeAll(java.util.Collection<?> coll) |
IList<E> |
removeAll(E elem)
Removes all equal elements.
|
boolean |
removeAll(IList<?> coll) |
E |
removeFirst() |
boolean |
removeFirstOccurrence(java.lang.Object elem) |
E |
removeLast() |
boolean |
removeLastOccurrence(java.lang.Object elem) |
void |
removeWhere(IPredicate<E> predicate)
Removes all elements in the list which match the predicate.
|
void |
replaceAll(int index,
int len,
java.util.Collection<? extends E> coll)
Replaces the specified range with new elements.
|
void |
replaceAll(int index,
int len,
IList<? extends E> list)
Replaces the specified range with new elements.
|
void |
replaceArray(int index,
int len,
E... elems)
Replaces the specified range with new elements.
|
void |
replaceMult(int index,
int len,
int numElems,
E elem)
Replaces the specified range with new elements.
|
void |
resize(int len,
E elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(java.util.Collection<?> coll) |
boolean |
retainAll(IList<?> coll) |
void |
retainWhere(IPredicate<E> 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.
|
E |
set(int index,
E elem) |
void |
setAll(int index,
java.util.Collection<? extends E> coll)
Sets the specified elements.
|
void |
setAll(int index,
IList<? extends E> list)
Sets the specified elements.
|
void |
setArray(int index,
E... elems)
Sets the specified elements.
|
void |
setMult(int index,
int len,
E elem)
Sets the element multiple times.
|
abstract int |
size() |
void |
sort(java.util.Comparator<? super E> comparator)
Sort elements in the list using the specified comparator.
|
abstract void |
sort(int index,
int len,
java.util.Comparator<? super E> comparator)
Sort specified elements in the list using the specified comparator.
|
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
<T> T[] |
toArray(T[] array) |
java.lang.String |
toString() |
static <E> void |
transferCopy(IList<E> src,
int srcIndex,
int srcLen,
IList<? super E> dst,
int dstIndex,
int dstLen)
Copies elements from one list to another.
|
static <E> void |
transferMove(IList<E> src,
int srcIndex,
int srcLen,
IList<? super E> dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by setting it to null in the source list.
|
static <E> void |
transferRemove(IList<E> src,
int srcIndex,
int srcLen,
IList<? super E> dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by removing it from the source list.
|
static <E> void |
transferSwap(IList<E> src,
int srcIndex,
IList<E> dst,
int dstIndex,
int len)
Swaps elements from two lists.
|
abstract void |
trimToSize()
An application can use this operation to minimize the storage of an instance.
|
abstract IList<E> |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public IList<E> copy()
clone()public abstract IList<E> unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void clear()
public void resize(int len,
E 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 E get(int index)
public E put(int index, E elem)
index - index where element will be placedelem - element to putpublic boolean add(E elem)
public void add(int index,
E elem)
public E remove(int index)
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic abstract void trimToSize()
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
toString in class java.util.AbstractCollection<E>public boolean isEmpty()
public int getCount(E elem)
elem - element to countpublic IList<E> getAll(E elem)
elem - element to look forpublic IList<E> getWhere(IPredicate<E> predicate)
predicate - predicatepublic void removeWhere(IPredicate<E> predicate)
predicate - predicatepublic void retainWhere(IPredicate<E> predicate)
predicate - predicatepublic IList<E> extractWhere(IPredicate<E> predicate)
predicate - predicatepublic java.util.Set<E> getDistinct()
public <R> IList<R> mappedList(IFunction<E,R> mapper)
mapper - mapper functionpublic void filter(IPredicate<? super E> predicate)
predicate - predicate used for filteringpublic int indexOf(java.lang.Object elem)
public int lastIndexOf(java.lang.Object elem)
public int indexOf(java.lang.Object elem,
int fromIndex)
elem - element to search forfromIndex - start index for searchindexOf(Object)public int lastIndexOf(java.lang.Object elem,
int fromIndex)
elem - element to search forfromIndex - start index for searchlastIndexOf(Object)public boolean remove(java.lang.Object elem)
public boolean contains(java.lang.Object elem)
public boolean addIfAbsent(E elem)
elem - element to addpublic boolean containsAny(java.util.Collection<?> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<?> coll)
public IList<E> removeAll(E elem)
elem - elementpublic boolean removeAll(java.util.Collection<?> coll)
public boolean removeAll(IList<?> coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<?> coll)
public boolean retainAll(IList<?> coll)
retainAll(Collection)public java.lang.Object[] toArray()
public java.lang.Object[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic <T> T[] toArray(T[] array)
public java.util.Iterator<E> iterator()
public java.util.ListIterator<E> listIterator()
public java.util.ListIterator<E> listIterator(int index)
public java.util.Iterator<E> descendingIterator()
descendingIterator in interface java.util.Deque<E>public E peek()
public E element()
public E poll()
public E remove()
public boolean offer(E elem)
public boolean offerFirst(E elem)
offerFirst in interface java.util.Deque<E>public boolean removeFirstOccurrence(java.lang.Object elem)
removeFirstOccurrence in interface java.util.Deque<E>public boolean removeLastOccurrence(java.lang.Object elem)
removeLastOccurrence in interface java.util.Deque<E>public static <E> void transferCopy(IList<E> src, int srcIndex, int srcLen, IList<? super E> dst, int dstIndex, int dstLen)
copy(int, int, int).E - type of elements stored in the listsrc - 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 listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static <E> void transferMove(IList<E> src, int srcIndex, int srcLen, IList<? super E> dst, int dstIndex, int dstLen)
move(int, int, int).E - type of elements stored in the listsrc - 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 listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static <E> void transferRemove(IList<E> src, int srcIndex, int srcLen, IList<? super E> dst, int dstIndex, int dstLen)
drag(int, int, int).E - type of elements stored in the listsrc - 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 listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static <E> void transferSwap(IList<E> src, int srcIndex, IList<E> dst, int dstIndex, int len)
swap(int, int, int).E - type of elements stored in the listsrc - first listsrcIndex - index of first element in first listdst - second listdstIndex - index of first element in second listlen - number of elements to swapjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic IList<E> getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic IList<E> extract(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic E[] getArray(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(IList<? extends E> list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is nullpublic boolean addAll(int index,
IList<? extends E> 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<? extends E> coll)
addAll in interface java.util.Collection<E>addAll in interface java.util.List<E>addAll in class java.util.AbstractCollection<E>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<? extends E> coll)
addAll in interface java.util.List<E>addAll in class java.util.AbstractList<E>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(E... elems)
elems - elements to be added to this listpublic boolean addArray(int index,
E... 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,
E elem)
elem - element to be added to this listpublic boolean addMult(int index,
int len,
E 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,
IList<? extends E> 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<? extends E> coll)
index - index of first element to setcoll - collection with elements to setpublic void setArray(int index,
E... elems)
index - index of first element to setelemes - array with elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void setMult(int index,
int len,
E elem)
index - index of first element to setelem - element to setpublic void putAll(int index,
IList<? extends E> list)
index - index of first element to set or addlist - list with elements to set or addpublic void putAll(int index,
java.util.Collection<? extends E> coll)
index - index of first element to set or addcoll - collection with elements to set or addpublic void putArray(int index,
E... elems)
index - index of first element to set or addelems - array with elements to set or addpublic void putMult(int index,
int len,
E elem)
index - index of first element to set or addlen - element to set or addpublic void initAll(IList<? extends E> list)
list - list with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initAll(java.util.Collection<? extends E> coll)
coll - collection with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initArray(E... elems)
elems - array with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initMult(int len,
E 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<? extends E> 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,
E... 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,
E 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,
IList<? extends E> 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(E 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(java.util.Comparator<? super E> comparator)
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,
java.util.Comparator<? super E> comparator)
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 <K> int binarySearch(K key,
java.util.Comparator<? super K> comparator)
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 <K> int binarySearch(int index,
int len,
K key,
java.util.Comparator<? super K> comparator)
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)