public class ShortGapList extends IShortList
Note that this implementation is not synchronized.
Note that the iterators provided are not fail-fast.
List,
ArrayList,
LinkedList,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CAPACITY
Default capacity for list
|
| Constructor and Description |
|---|
ShortGapList()
Construct a list with the default initial capacity.
|
ShortGapList(java.util.Collection<java.lang.Short> coll)
Construct a list to contain the specified elements.
|
ShortGapList(int capacity)
Construct a list with specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
short elem) |
boolean |
add(short elem) |
int |
binarySearch(int index,
int len,
short key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
capacity()
Returns capacity of this list.
|
java.lang.Object |
clone()
Returns a shallow copy of this ShortGapList instance
(The elements themselves are not copied).
|
ShortGapList |
copy()
Returns a shallow copy of this ShortGapList instance.
|
static ShortGapList |
create()
Create new list.
|
static ShortGapList |
create(java.util.Collection<java.lang.Short> coll)
Create new list with specified elements.
|
static ShortGapList |
create(short... elems)
Create new list with specified elements.
|
IShortList |
doCreate(int capacity)
Create list with specified capacity.
|
static ShortGapList |
EMPTY() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ShortGapList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
short |
get(int index) |
ShortGapList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
ShortGapList |
getAll(short elem)
Returns all elements in the list equal to the specified element.
|
short |
getDefaultElem() |
void |
init()
Initialize the list to be empty.
|
void |
init(java.util.Collection<java.lang.Short> coll)
Initialize the list to contain the specified elements only.
|
void |
init(short... elems)
Initialize the list to contain the specified elements only.
|
<R> GapList<R> |
mappedList(IFunction<java.lang.Short,R> mapper)
Create a new list by applying the specified mapper to all elements.
|
short |
remove(int index) |
int |
size() |
void |
sort(int index,
int len)
Sort specified elements in the list using the specified comparator.
|
void |
trimToSize()
Trims the capacity of this ShortGapList instance to be the list's current size.
|
ShortGapList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
addAll, addAll, addAll, addAll, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, binarySearch, clear, contains, containsAll, containsAny, copy, drag, element, equals, extract, extractWhere, fill, filter, getArray, getCount, getDistinct, getFirst, getLast, getWhere, hashCode, indexOf, indexOf, initAll, initAll, initArray, initMult, isEmpty, lastIndexOf, lastIndexOf, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, removeAll, removeAll, removeAll, removeElem, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, removeWhere, replaceAll, replaceAll, replaceArray, replaceMult, resize, retainAll, retainAll, retainWhere, reverse, reverse, rotate, rotate, set, setAll, setAll, setArray, setMult, sort, swap, toArray, toArray, toArray, toString, transferCopy, transferMove, transferRemove, transferSwappublic static final int DEFAULT_CAPACITY
public ShortGapList()
public ShortGapList(int capacity)
capacity - capacitypublic ShortGapList(java.util.Collection<java.lang.Short> coll)
coll - collection with elementspublic static ShortGapList EMPTY()
public static ShortGapList create()
type - of elements stored in the listpublic static ShortGapList create(java.util.Collection<java.lang.Short> coll)
coll - collection with elementtype - of elements stored in the listpublic static ShortGapList create(short... elems)
elems - array with elementstype - of elements stored in the listpublic void init()
public void init(java.util.Collection<java.lang.Short> coll)
coll - collection with elementspublic void init(short... elems)
elems - array with elementspublic short getDefaultElem()
public ShortGapList copy()
copy in class IShortListIShortList.clone()public void ensureCapacity(int minCapacity)
ensureCapacity in class IShortListminCapacity - the desired minimum capacitypublic java.lang.Object clone()
clone in class IShortListpublic ShortGapList unmodifiableList()
IShortListunmodifiableList in class IShortListpublic int size()
size in class IShortListpublic int capacity()
IShortListcapacity in class IShortListpublic short get(int index)
get in class IShortListpublic boolean add(short elem)
add in class IShortListpublic void add(int index,
short elem)
add in class IShortListpublic ShortGapList getAll(int index, int len)
IShortListgetAll in class IShortListindex - index of first element to retrievelen - number of elements to retrievepublic ShortGapList getAll(short elem)
IShortListgetAll in class IShortListelem - element to look forpublic <R> GapList<R> mappedList(IFunction<java.lang.Short,R> mapper)
IShortListmappedList in class IShortListmapper - mapper functionpublic short remove(int index)
remove in class IShortListpublic void trimToSize()
trimToSize in class IShortListpublic IShortList doCreate(int capacity)
IShortListcapacity - initial capacity (use -1 for default capacity)public void sort(int index,
int len)
IShortListsort in class IShortListindex - index of first element to sortlen - number of elements to sortArrays.sort(int[])public int binarySearch(int index,
int len,
short key)
IShortListbinarySearch in class IShortListindex - index of first element to searchlen - number of elements to searchkey - the value to be searched forArrays.binarySearch(long[], long)