public class ShortObjGapList extends IList<java.lang.Short>
Note that this implementation is not synchronized.
GapList,
ShortGapList,
Serialized Form| Constructor and Description |
|---|
ShortObjGapList() |
ShortObjGapList(java.util.Collection<? extends java.lang.Short> elems) |
ShortObjGapList(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAll(java.util.Collection<? extends java.lang.Short> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(IList<? extends java.lang.Short> list2)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(int index,
java.util.Collection<? extends 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,
IList<? extends java.lang.Short> list2)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
boolean |
addAll(int index,
java.lang.Short... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addAll(java.lang.Short... elems)
Adds all specified elements into this list.
|
<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.
|
int |
capacity()
Returns capacity of this GapList.
|
boolean |
contains(java.lang.Object elem)
Returns true if this collection contains the specified element.
|
boolean |
containsAll(java.util.Collection<?> coll)
Returns true if this collection contains all of the elements
in the specified collection.
|
boolean |
containsAny(java.util.Collection<?> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
ShortObjGapList |
copy()
Returns a shallow copy of this list instance.
|
static ShortObjGapList |
create() |
static ShortObjGapList |
create(java.util.Collection<? extends java.lang.Short> elems) |
static ShortObjGapList |
create(java.lang.Short... elems) |
IList<java.lang.Short> |
doCreate(int capacity)
Create list with specified capacity.
|
boolean |
equals(java.lang.Object obj)
Compares the specified object with this list for equality.
|
java.lang.Short |
get(int index)
Returns the element at the specified position in this list.
|
GapList<java.lang.Short> |
getAll(int index,
int len)
Returns specified range of elements from list.
|
java.lang.Short[] |
getArray(int index,
int len)
Returns specified range of elements from list as array.
|
java.lang.Short |
getDefaultElem() |
int |
hashCode()
Returns the hash code value for this list.
|
int |
indexOf(java.lang.Object elem)
Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
void |
init() |
void |
init(java.util.Collection<? extends java.lang.Short> elems) |
void |
init(java.lang.Short... elems) |
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
int |
lastIndexOf(java.lang.Object elem)
Returns the index of the last occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
remove(java.lang.Object elem)
Removes a single instance of the specified element from this
collection, if it is present (optional operation).
|
boolean |
removeAll(java.util.Collection<?> coll)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean |
removeAll(IList<?> coll) |
boolean |
removeFirstOccurrence(java.lang.Object elem)
Removes the first occurrence of the specified element from this deque.
|
boolean |
removeLastOccurrence(java.lang.Object elem)
Removes the last occurrence of the specified element from this deque.
|
boolean |
retainAll(java.util.Collection<?> coll)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
boolean |
retainAll(IList<?> coll) |
void |
setAll(int index,
java.util.Collection<? extends java.lang.Short> coll)
Replaces the specified elements.
|
void |
setAll(int index,
IList<? extends java.lang.Short> list2)
Replaces the specified elements.
|
void |
setAll(int index,
java.lang.Short... elems)
Replaces the specified elements.
|
int |
size()
Returns the number of elements in this collection.
|
void |
sort(int index,
int len,
java.util.Comparator comparator)
Sort specified elements in the list using the specified comparator.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
java.lang.Object[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
<T> T[] |
toArray(T[] array)
Returns an array containing all of the elements in this collection;
the runtime type of the returned array is that of the specified array.
|
java.lang.String |
toString()
Returns a string representation of this collection.
|
void |
trimToSize()
An application can use this operation to minimize the storage of an instance.
|
ShortObjGapList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
add, add, addFirst, addIfAbsent, addLast, binarySearch, clear, clone, copy, copy, descendingIterator, drag, element, ensureCapacity, extract, fill, fill, filter, getAll, getCount, getDistinct, getFirst, getLast, init, iterator, listIterator, listIterator, mappedList, merge, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeAll, removeFirst, removeLast, resize, reverse, reverse, rotate, rotate, set, sort, swap, swappublic ShortObjGapList()
public ShortObjGapList(int capacity)
public ShortObjGapList(java.util.Collection<? extends java.lang.Short> elems)
public static ShortObjGapList create()
public static ShortObjGapList create(java.lang.Short... elems)
public static ShortObjGapList create(java.util.Collection<? extends java.lang.Short> elems)
public void init()
public void init(java.lang.Short... elems)
public void init(java.util.Collection<? extends java.lang.Short> elems)
public ShortObjGapList copy()
IListcopy in class IList<java.lang.Short>IList.clone()public java.lang.Short getDefaultElem()
public IList<java.lang.Short> doCreate(int capacity)
IListcapacity - initial capacity (use -1 for default capacity)public int size()
java.util.Collectionpublic int capacity()
public java.lang.Short get(int index)
java.util.AbstractListpublic void move(int srcIndex,
int dstIndex,
int len)
IListpublic void trimToSize()
IListtrimToSize in class IList<java.lang.Short>public boolean equals(java.lang.Object obj)
java.util.AbstractListtrue if and only if the specified object is also a list, both
lists have the same size, and all corresponding pairs of elements in
the two lists are equal. (Two elements e1 and
e2 are equal if (e1==null ? e2==null :
e1.equals(e2)).) In other words, two lists are defined to be
equal if they contain the same elements in the same order.
This implementation first checks if the specified object is this
list. If so, it returns true; if not, it checks if the
specified object is a list. If not, it returns false; if so,
it iterates over both lists, comparing corresponding pairs of elements.
If any comparison returns false, this method returns
false. If either iterator runs out of elements before the
other it returns false (as the lists are of unequal length);
otherwise it returns true when the iterations complete.
equals in interface java.util.Collection<java.lang.Short>equals in interface java.util.List<java.lang.Short>equals in class IList<java.lang.Short>obj - the object to be compared for equality with this listtrue if the specified object is equal to this listObject.hashCode(),
Hashtablepublic int hashCode()
java.util.AbstractListThis implementation uses exactly the code that is used to define the
list hash function in the documentation for the List.hashCode()
method.
public java.lang.String toString()
java.util.AbstractCollectionString.valueOf(Object).public boolean isEmpty()
java.util.AbstractCollectionThis implementation returns size() == 0.
public int indexOf(java.lang.Object elem)
java.util.AbstractListThis implementation first gets a list iterator (with
listIterator()). Then, it iterates over the list until the
specified element is found or the end of the list is reached.
public int lastIndexOf(java.lang.Object elem)
java.util.AbstractListThis implementation first gets a list iterator that points to the end
of the list (with listIterator(size())). Then, it iterates
backwards over the list until the specified element is found, or the
beginning of the list is reached.
lastIndexOf in interface java.util.List<java.lang.Short>lastIndexOf in class IList<java.lang.Short>elem - element to search forpublic boolean remove(java.lang.Object elem)
java.util.AbstractCollectionThis implementation iterates over the collection looking for the specified element. If it finds the element, it removes the element from the collection using the iterator's remove method.
Note that this implementation throws an UnsupportedOperationException if the iterator returned by this collection's iterator method does not implement the remove method and this collection contains the specified object.
remove in interface java.util.Collection<java.lang.Short>remove in interface java.util.Deque<java.lang.Short>remove in interface java.util.List<java.lang.Short>remove in class IList<java.lang.Short>elem - element to be removed from this collection, if presentpublic boolean contains(java.lang.Object elem)
java.util.AbstractCollectionThis implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
contains in interface java.util.Collection<java.lang.Short>contains in interface java.util.Deque<java.lang.Short>contains in interface java.util.List<java.lang.Short>contains in class IList<java.lang.Short>elem - element whose presence in this collection is to be testedpublic boolean containsAny(java.util.Collection<?> coll)
IListcontainsAny in class IList<java.lang.Short>coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<?> coll)
java.util.AbstractCollectionThis implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. If all elements are so contained true is returned, otherwise false.
containsAll in interface java.util.Collection<java.lang.Short>containsAll in interface java.util.List<java.lang.Short>containsAll in class IList<java.lang.Short>coll - collection to be checked for containment in this collectionAbstractCollection.contains(Object)public boolean removeAll(java.util.Collection<?> coll)
java.util.AbstractCollectionThis implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.
removeAll in interface java.util.Collection<java.lang.Short>removeAll in interface java.util.List<java.lang.Short>removeAll in class IList<java.lang.Short>coll - collection containing elements to be removed from this collectionAbstractCollection.remove(Object),
AbstractCollection.contains(Object)public boolean removeAll(IList<?> coll)
removeAll in class IList<java.lang.Short>IList.removeAll(Collection)public boolean retainAll(java.util.Collection<?> coll)
java.util.AbstractCollectionThis implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements not present in the specified collection.
retainAll in interface java.util.Collection<java.lang.Short>retainAll in interface java.util.List<java.lang.Short>retainAll in class IList<java.lang.Short>coll - collection containing elements to be retained in this collectionAbstractCollection.remove(Object),
AbstractCollection.contains(Object)public boolean retainAll(IList<?> coll)
retainAll in class IList<java.lang.Short>IList.retainAll(Collection)public java.lang.Object[] toArray()
java.util.AbstractCollectionThe returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
This implementation returns an array containing all the elements
returned by this collection's iterator, in the same order, stored in
consecutive elements of the array, starting with index 0.
The length of the returned array is equal to the number of elements
returned by the iterator, even if the size of this collection changes
during iteration, as might happen if the collection permits
concurrent modification during iteration. The size method is
called only as an optimization hint; the correct result is returned
even if the iterator returns a different number of elements.
This method is equivalent to:
List<E> list = new ArrayList<E>(size());
for (E e : this)
list.add(e);
return list.toArray();
public java.lang.Object[] toArray(int index,
int len)
IListpublic <T> T[] toArray(T[] array)
java.util.AbstractCollectionIf this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any null elements.)
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
Like the Collection.toArray() method, this method acts as bridge between
array-based and collection-based APIs. Further, this method allows
precise control over the runtime type of the output array, and may,
under certain circumstances, be used to save allocation costs.
Suppose x is a collection known to contain only strings. The following code can be used to dump the collection into a newly allocated array of String:
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
This implementation returns an array containing all the elements
returned by this collection's iterator in the same order, stored in
consecutive elements of the array, starting with index 0.
If the number of elements returned by the iterator is too large to
fit into the specified array, then the elements are returned in a
newly allocated array with length equal to the number of elements
returned by the iterator, even if the size of this collection
changes during iteration, as might happen if the collection permits
concurrent modification during iteration. The size method is
called only as an optimization hint; the correct result is returned
even if the iterator returns a different number of elements.
This method is equivalent to:
List<E> list = new ArrayList<E>(size());
for (E e : this)
list.add(e);
return list.toArray(a);
toArray in interface java.util.Collection<java.lang.Short>toArray in interface java.util.List<java.lang.Short>toArray in class IList<java.lang.Short>array - the array into which the elements of this collection are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.public boolean addAll(java.util.Collection<? extends java.lang.Short> coll)
IListaddAll in interface java.util.Collection<java.lang.Short>addAll in interface java.util.List<java.lang.Short>addAll in class IList<java.lang.Short>coll - collection containing elements to be added to this listAbstractCollection.add(Object)public boolean addAll(int index,
java.util.Collection<? extends java.lang.Short> coll)
IListaddAll in interface java.util.List<java.lang.Short>addAll in class IList<java.lang.Short>index - index at which to insert the first element from the
specified collectioncoll - collection containing elements to be inserted into this listpublic boolean addAll(java.lang.Short... elems)
IListpublic boolean addAll(int index,
java.lang.Short... elems)
IListpublic boolean addAll(IList<? extends java.lang.Short> list2)
IListpublic boolean addAll(int index,
IList<? extends java.lang.Short> list2)
IListpublic boolean removeFirstOccurrence(java.lang.Object elem)
java.util.DequeremoveFirstOccurrence in interface java.util.Deque<java.lang.Short>removeFirstOccurrence in class IList<java.lang.Short>elem - element to be removed from this deque, if presentpublic boolean removeLastOccurrence(java.lang.Object elem)
java.util.DequeremoveLastOccurrence in interface java.util.Deque<java.lang.Short>removeLastOccurrence in class IList<java.lang.Short>elem - element to be removed from this deque, if presentpublic GapList<java.lang.Short> getAll(int index, int len)
IListpublic java.lang.Short[] getArray(int index,
int len)
IListpublic void setAll(int index,
IList<? extends java.lang.Short> list2)
IListpublic void setAll(int index,
java.util.Collection<? extends java.lang.Short> coll)
IListpublic void setAll(int index,
java.lang.Short... elems)
IListpublic void sort(int index,
int len,
java.util.Comparator comparator)
IListpublic <K> int binarySearch(int index,
int len,
K key,
java.util.Comparator<? super K> comparator)
IListbinarySearch in class IList<java.lang.Short>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.Arrays.binarySearch(long[], long)public ShortObjGapList unmodifiableList()
IListunmodifiableList in class IList<java.lang.Short>