public abstract class IShortList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
List,
Deque,
ArrayList,
LinkedList,
Serialized Form| Constructor and Description |
|---|
IShortList() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
short elem) |
boolean |
add(short elem) |
boolean |
addAll(java.util.Collection<java.lang.Short> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(int index,
java.util.Collection<java.lang.Short> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addAll(int index,
IShortList list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
boolean |
addAll(IShortList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addArray(int index,
short... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addArray(short... elems)
Adds all specified elements into this list.
|
void |
addFirst(short elem) |
boolean |
addIfAbsent(short elem)
Add elements if it is not already contained in the list.
|
void |
addLast(short elem) |
boolean |
addMult(int index,
int len,
short elem)
Inserts element multiple time to list, starting at the specified position.
|
boolean |
addMult(int len,
short elem)
Adds element multiple time to list.
|
abstract int |
binarySearch(int index,
int len,
short key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
binarySearch(short key)
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(short elem) |
boolean |
containsAll(java.util.Collection<java.lang.Short> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Short> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
IShortList |
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.
|
short |
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) |
IShortList |
extract(int index,
int len)
Removes specified range of elements from list and return them.
|
IShortList |
extractWhere(IPredicate predicate)
Removes and returns all elements in the list which match the predicate.
|
void |
fill(short elem)
Fill list.
|
void |
filter(IPredicate<java.lang.Short> predicate)
Filter the list using the specified predicate.
|
short |
get(int index) |
IShortList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
IShortList |
getAll(short elem)
Returns all elements in the list equal to the specified element.
|
short[] |
getArray(int index,
int len)
Returns specified range of elements from list as array.
|
int |
getCount(short elem)
Counts how many times the specified element is contained in the list.
|
java.util.Set |
getDistinct()
Returns distinct elements in the list.
|
short |
getFirst() |
short |
getLast() |
IShortList |
getWhere(IPredicate predicate)
Returns all elements in the list which match the predicate.
|
int |
hashCode() |
int |
indexOf(short elem) |
int |
indexOf(short 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<java.lang.Short> coll)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initAll(IShortList list)
Initializes the list so it will afterwards only contain the elements of the collection.
|
void |
initArray(short... elems)
Initializes the list so it will afterwards only contain the elements of the array.
|
void |
initMult(int len,
short elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(short elem) |
int |
lastIndexOf(short elem,
int fromIndex)
Returns the index of the last occurrence of the specified element in this list, starting the search at the specified position.
|
<R> IList<R> |
mappedList(IFunction<java.lang.Short,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(short elem) |
boolean |
offerFirst(short elem) |
boolean |
offerLast(short elem) |
short |
peek() |
short |
peekFirst() |
short |
peekLast() |
short |
poll() |
short |
pollFirst() |
short |
pollLast() |
short |
pop() |
void |
push(short elem) |
short |
put(int index,
short elem)
Sets or adds the element.
|
void |
putAll(int index,
java.util.Collection<java.lang.Short> coll)
Set or add the specified elements.
|
void |
putAll(int index,
IShortList list)
Set or add the specified elements.
|
void |
putArray(int index,
short... elems)
Set or add the specified elements.
|
void |
putMult(int index,
int len,
short elem)
Set or add the specified element multiple times.
|
short |
remove() |
short |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
boolean |
removeAll(java.util.Collection<java.lang.Short> coll) |
boolean |
removeAll(IShortList coll) |
IShortList |
removeAll(short elem)
Removes all equal elements.
|
boolean |
removeElem(short elem) |
short |
removeFirst() |
boolean |
removeFirstOccurrence(short elem) |
short |
removeLast() |
boolean |
removeLastOccurrence(short elem) |
void |
removeWhere(IPredicate predicate)
Removes all elements in the list which match the predicate.
|
void |
replaceAll(int index,
int len,
java.util.Collection<java.lang.Short> coll)
Replaces the specified range with new elements.
|
void |
replaceAll(int index,
int len,
IShortList list)
Replaces the specified range with new elements.
|
void |
replaceArray(int index,
int len,
short... elems)
Replaces the specified range with new elements.
|
void |
replaceMult(int index,
int len,
int numElems,
short elem)
Replaces the specified range with new elements.
|
void |
resize(int len,
short elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(java.util.Collection<java.lang.Short> coll) |
boolean |
retainAll(IShortList coll) |
void |
retainWhere(IPredicate 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.
|
short |
set(int index,
short elem) |
void |
setAll(int index,
java.util.Collection<java.lang.Short> coll)
Sets the specified elements.
|
void |
setAll(int index,
IShortList list)
Sets the specified elements.
|
void |
setArray(int index,
short... elems)
Sets the specified elements.
|
void |
setMult(int index,
int len,
short 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.
|
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
short[] |
toArray() |
short[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
short[] |
toArray(short[] array) |
java.lang.String |
toString() |
static void |
transferCopy(IShortList src,
int srcIndex,
int srcLen,
IShortList dst,
int dstIndex,
int dstLen)
Copies elements from one list to another.
|
static void |
transferMove(IShortList src,
int srcIndex,
int srcLen,
IShortList dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by setting it to null in the source list.
|
static void |
transferRemove(IShortList src,
int srcIndex,
int srcLen,
IShortList dst,
int dstIndex,
int dstLen)
Moves elements from one list to another by removing it from the source list.
|
static void |
transferSwap(IShortList src,
int srcIndex,
IShortList 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 IShortList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public IShortList copy()
clone()public abstract IShortList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void clear()
public void resize(int len,
short 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 short get(int index)
public short set(int index,
short elem)
public short put(int index,
short elem)
index - index where element will be placedelem - element to putpublic boolean add(short elem)
public void add(int index,
short elem)
public short 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 class java.lang.Objectpublic boolean isEmpty()
public int getCount(short elem)
elem - element to countpublic IShortList getAll(short elem)
elem - element to look forpublic IShortList getWhere(IPredicate predicate)
predicate - predicatepublic void removeWhere(IPredicate predicate)
predicate - predicatepublic void retainWhere(IPredicate predicate)
predicate - predicatepublic IShortList extractWhere(IPredicate predicate)
predicate - predicatepublic java.util.Set getDistinct()
public <R> IList<R> mappedList(IFunction<java.lang.Short,R> mapper)
mapper - mapper functionpublic void filter(IPredicate<java.lang.Short> predicate)
predicate - predicate used for filteringpublic int indexOf(short elem)
public int lastIndexOf(short elem)
public int indexOf(short elem,
int fromIndex)
elem - element to search forfromIndex - start index for search#indexOf(Object)public int lastIndexOf(short elem,
int fromIndex)
elem - element to search forfromIndex - start index for search#lastIndexOf(Object)public boolean removeElem(short elem)
public boolean contains(short elem)
public boolean addIfAbsent(short elem)
elem - element to addpublic boolean containsAny(java.util.Collection<java.lang.Short> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Short> coll)
public IShortList removeAll(short elem)
elem - elementpublic boolean removeAll(java.util.Collection<java.lang.Short> coll)
public boolean removeAll(IShortList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Short> coll)
public boolean retainAll(IShortList coll)
retainAll(Collection)public short[] toArray()
public short[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic short[] toArray(short[] array)
public short peek()
public short element()
public short poll()
public short remove()
public boolean offer(short elem)
public short getFirst()
public short getLast()
public void addFirst(short elem)
public void addLast(short elem)
public short removeFirst()
public short removeLast()
public boolean offerFirst(short elem)
public boolean offerLast(short elem)
public short peekFirst()
public short peekLast()
public short pollFirst()
public short pollLast()
public short pop()
public void push(short elem)
public boolean removeFirstOccurrence(short elem)
public boolean removeLastOccurrence(short elem)
public static void transferCopy(IShortList src, int srcIndex, int srcLen, IShortList 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(IShortList src, int srcIndex, int srcLen, IShortList 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(IShortList src, int srcIndex, int srcLen, IShortList 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(IShortList src, int srcIndex, IShortList 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 IShortList getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic IShortList extract(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic short[] 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(IShortList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is nullpublic boolean addAll(int index,
IShortList 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.Short> 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.Short> 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(short... elems)
elems - elements to be added to this listpublic boolean addArray(int index,
short... 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,
short elem)
elem - element to be added to this listpublic boolean addMult(int index,
int len,
short 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,
IShortList 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.Short> coll)
index - index of first element to setcoll - collection with elements to setpublic void setArray(int index,
short... elems)
index - index of first element to setlist - list with elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void setMult(int index,
int len,
short elem)
index - index of first element to setelem - element to setpublic void putAll(int index,
IShortList 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.Short> coll)
index - index of first element to set or addcoll - collection with elements to set or addpublic void putArray(int index,
short... elems)
index - index of first element to set or addcoll - collection with elements to set or addpublic void putMult(int index,
int len,
short elem)
index - index of first element to set or addlen - element to set or addpublic void initAll(IShortList list)
coll - collection with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initAll(java.util.Collection<java.lang.Short> coll)
coll - collection with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initArray(short... elems)
elems - array with elementsjava.lang.IndexOutOfBoundsException - if the length is invalidpublic void initMult(int len,
short 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.Short> 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,
short... 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,
short 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,
IShortList 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(short 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(short 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,
short 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)