Top Description Fields Constructors Methods
org.apache.poi.util

public Class IntList

extends Object
Class Inheritance

A List of int'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: the mimicry is not perfect, however:

Field Summary

Modifier and TypeField and Description
private int[]
private static final int
private int

Constructor Summary

AccessConstructor and Description
public
IntList()

create an IntList of default size

public
IntList(final int initialCapacity)

public
IntList(final IntList
the existing IntList
list
)

create a copy of an existing IntList

Method Summary

Modifier and TypeMethod and Description
public void
add(final int
the index where the new value is to be added
index
,
final int
the new value
value
)

add the specified value at the specified index

public boolean

Returns:

true (as per the general contract of the Collection.add method).
add
(final int
element to be appended to this list.
value
)

Appends the specified element to the end of this list

public boolean

Returns:

true if this list changed as a result of the call.
addAll
(final IntList
collection whose elements are to be added to this list.
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.

public boolean

Returns:

true if this list changed as a result of the call.
addAll
(final int
index at which to insert first element from the specified collection.
index
,
final IntList
elements to be inserted into this list.
c
)

Inserts all of the elements in the specified collection into this list at the specified position.

public void
clear()

Removes all of the elements from this list.

public boolean

Returns:

true if this list contains the specified element.
contains
(final int
element whose presence in this list is to be tested.
o
)

Returns true if this list contains the specified element.

public boolean

Returns:

true if this list contains all of the elements of the specified collection.
containsAll
(final IntList
collection to be checked for containment in this list.
c
)

Returns true if this list contains all of the elements of the specified collection.

public boolean

Returns:

true if the specified object is equal to this list.
equals
(final Object
the object to be compared for equality with this list.
o
)

Overrides java.lang.Object.equals.

Compares the specified object with this list for equality.

public int

Returns:

the element at the specified position in this list.
get
(final int
index of element to return.
index
)

Returns the element at the specified position in this list.

private void
growArray(final int new_size)

public int

Returns:

the hash code value for this list.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this list.

public int

Returns:

the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
indexOf
(final int
element to search for.
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.

public boolean

Returns:

true if this list contains no elements.
isEmpty
()

Returns true if this list contains no elements.

public int

Returns:

the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
lastIndexOf
(final int
element to search for.
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.

public int

Returns:

the element previously at the specified position.
remove
(final int
the index of the element to removed.
index
)

Removes the element at the specified position in this list.

public boolean

Returns:

true if this list changed as a result of the call.
removeAll
(final IntList
collection that defines which elements will be removed from this list.
c
)

Removes from this list all the elements that are contained in the specified collection

public boolean

Returns:

true if this list contained the specified element.
removeValue
(final int
element to be removed from this list, if present.
o
)

Removes the first occurrence in this list of the specified element (optional operation).

public boolean

Returns:

true if this list changed as a result of the call.
retainAll
(final IntList
collection that defines which elements this set will retain.
c
)

Retains only the elements in this list that are contained in the specified collection.

public int

Returns:

the element previously at the specified position.
set
(final int
index of element to replace.
index
,
final int
element to be stored at the specified position.
element
)

Replaces the element at the specified position in this list with the specified element

public int

Returns:

the number of elements in this IntList
size
()

Returns the number of elements in this list.

public int[]

Returns:

an array containing all of the elements in this list in proper sequence.
toArray
()

Returns an array containing all of the elements in this list in proper sequence.

public int[]

Returns:

an array containing the elements of this list.
toArray
(final int[]
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.
a
)

Returns an array containing all of the elements in this list in proper sequence.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

_arrayback to summary
private int[] _array
_default_sizeback to summary
private static final int _default_size
_limitback to summary
private int _limit

Constructor Detail

IntListback to summary
public IntList()

create an IntList of default size

IntListback to summary
public IntList(final int initialCapacity)
IntListback to summary
public IntList(final IntList list)

create a copy of an existing IntList

Parameters
list:IntList

the existing IntList

Method Detail

addback to summary
public void add(final int index, final int value)

add the specified value at the specified index

Parameters
index:int

the index where the new value is to be added

value:int

the new value

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index > size()).
addback to summary
public boolean add(final int value)

Appends the specified element to the end of this list

Parameters
value:int

element to be appended to this list.

Returns:boolean

true (as per the general contract of the Collection.add method).

addAllback to summary
public boolean addAll(final IntList 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. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)

Parameters
c:IntList

collection whose elements are to be added to this list.

Returns:boolean

true if this list changed as a result of the call.

addAllback to summary
public boolean addAll(final int index, final IntList c)

Inserts all of the elements in the specified collection into this list at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)

Parameters
index:int

index at which to insert first element from the specified collection.

c:IntList

elements to be inserted into this list.

Returns:boolean

true if this list changed as a result of the call.

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index > size())
clearback to summary
public void clear()

Removes all of the elements from this list. This list will be empty after this call returns (unless it throws an exception).

containsback to summary
public boolean contains(final int o)

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that o == e

Parameters
o:int

element whose presence in this list is to be tested.

Returns:boolean

true if this list contains the specified element.

containsAllback to summary
public boolean containsAll(final IntList c)

Returns true if this list contains all of the elements of the specified collection.

Parameters
c:IntList

collection to be checked for containment in this list.

Returns:boolean

true if this list contains all of the elements of the specified collection.

equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Compares the specified object with this list for equality. Returns true 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 == e2.) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.

Parameters
o:Object

the object to be compared for equality with this list.

Returns:boolean

true if the specified object is equal to this list.

getback to summary
public int get(final int index)

Returns the element at the specified position in this list.

Parameters
index:int

index of element to return.

Returns:int

the element at the specified position in this list.

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= size()).
growArrayback to summary
private void growArray(final int new_size)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation: 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.

Returns:int

the hash code value for this list.

indexOfback to summary
public int indexOf(final int 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. More formally, returns the lowest index i such that (o == get(i)), or -1 if there is no such index.

Parameters
o:int

element to search for.

Returns:int

the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

isEmptyback to summary
public boolean isEmpty()

Returns true if this list contains no elements.

Returns:boolean

true if this list contains no elements.

lastIndexOfback to summary
public int lastIndexOf(final int 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. More formally, returns the highest index i such that (o == get(i)), or -1 if there is no such index.

Parameters
o:int

element to search for.

Returns:int

the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.

removeback to summary
public int remove(final int index)

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Parameters
index:int

the index of the element to removed.

Returns:int

the element previously at the specified position.

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= size()).
removeAllback to summary
public boolean removeAll(final IntList c)

Removes from this list all the elements that are contained in the specified collection

Parameters
c:IntList

collection that defines which elements will be removed from this list.

Returns:boolean

true if this list changed as a result of the call.

removeValueback to summary
public boolean removeValue(final int o)

Removes the first occurrence in this list of the specified element (optional operation). If this list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o.equals(get(i))) (if such an element exists).

Parameters
o:int

element to be removed from this list, if present.

Returns:boolean

true if this list contained the specified element.

retainAllback to summary
public boolean retainAll(final IntList c)

Retains only the elements in this list that are contained in the specified collection. In other words, removes from this list all the elements that are not contained in the specified collection.

Parameters
c:IntList

collection that defines which elements this set will retain.

Returns:boolean

true if this list changed as a result of the call.

setback to summary
public int set(final int index, final int element)

Replaces the element at the specified position in this list with the specified element

Parameters
index:int

index of element to replace.

element:int

element to be stored at the specified position.

Returns:int

the element previously at the specified position.

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= size()).
sizeback to summary
public int size()

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this IntList

toArrayback to summary
public int[] toArray()

Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray method.

Returns:int[]

an array containing all of the elements in this list in proper sequence.

toArrayback to summary
public int[] toArray(final int[] a)

Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray(Object[]) method.

Parameters
a:int[]

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.

Returns:int[]

an array containing the elements of this list.