|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.util.ShortList
public class ShortList
A List of short's; as full an implementation of the java.util.List interface as possible, with an eye toward minimal creation of objects the mimicry of List is as follows:
Constructor Summary | |
---|---|
ShortList()
create an ShortList of default size |
|
ShortList(int initialCapacity)
create an ShortList with a predefined initial size |
|
ShortList(ShortList list)
create a copy of an existing ShortList |
Method Summary | |
---|---|
void |
add(int index,
short value)
add the specfied value at the specified index |
boolean |
add(short value)
Appends the specified element to the end of this list |
boolean |
addAll(int index,
ShortList c)
Inserts all of the elements in the specified collection into this list at the specified position. |
boolean |
addAll(ShortList c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator. |
void |
clear()
Removes all of the elements from this list. |
boolean |
contains(short o)
Returns true if this list contains the specified element. |
boolean |
containsAll(ShortList c)
Returns true if this list contains all of the elements of the specified collection. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this list for equality. |
short |
get(int index)
Returns the element at the specified position in this list. |
int |
hashCode()
Returns the hash code value for this list. |
int |
indexOf(short o)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. |
boolean |
isEmpty()
Returns true if this list contains no elements. |
int |
lastIndexOf(short o)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. |
short |
remove(int index)
Removes the element at the specified position in this list. |
boolean |
removeAll(ShortList c)
Removes from this list all the elements that are contained in the specified collection |
boolean |
removeValue(short o)
Removes the first occurrence in this list of the specified element (optional operation). |
boolean |
retainAll(ShortList c)
Retains only the elements in this list that are contained in the specified collection. |
short |
set(int index,
short element)
Replaces the element at the specified position in this list with the specified element |
int |
size()
Returns the number of elements in this list. |
short[] |
toArray()
Returns an array containing all of the elements in this list in proper sequence. |
short[] |
toArray(short[] a)
Returns an array containing all of the elements in this list in proper sequence. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShortList()
public ShortList(ShortList list)
list
- the existing ShortListpublic ShortList(int initialCapacity)
initialCapacity
- the size for the internal arrayMethod Detail |
---|
public void add(int index, short value)
index
- the index where the new value is to be addedvalue
- the new value
java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index > size()).public boolean add(short value)
value
- element to be appended to this list.
public boolean addAll(ShortList c)
c
- collection whose elements are to be added to this
list.
public boolean addAll(int index, ShortList c)
index
- index at which to insert first element from the
specified collection.c
- elements to be inserted into this list.
java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index > size())public void clear()
public boolean contains(short o)
o
- element whose presence in this list is to be tested.
public boolean containsAll(ShortList c)
c
- collection to be checked for containment in this list.
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to be compared for equality with this list.
public short get(int index)
index
- index of element to return.
java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public int hashCode()
hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext()) {
Object obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that list1.equals(list2) implies that
list1.hashCode()==list2.hashCode() for any two lists, list1 and
list2, as required by the general contract of Object.hashCode.
hashCode
in class java.lang.Object
public int indexOf(short o)
o
- element to search for.
public boolean isEmpty()
public int lastIndexOf(short o)
o
- element to search for.
public short remove(int index)
index
- the index of the element to removed.
java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public boolean removeValue(short o)
o
- element to be removed from this list, if present.
public boolean removeAll(ShortList c)
c
- collection that defines which elements will be removed
from this list.
public boolean retainAll(ShortList c)
c
- collection that defines which elements this set will
retain.
public short set(int index, short element)
index
- index of element to replace.element
- element to be stored at the specified position.
java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public int size()
public short[] toArray()
public short[] toArray(short[] a)
a
- the array into which the elements of this list are to
be stored, if it is big enough; otherwise, a new array
is allocated for this purpose.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |