|
org.netbeans.modules.editor.util/1 1.17 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
org.netbeans.lib.editor.util.GapList<E>
public class GapList<E>
List implementation that stores items in an array with a gap.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
GapList()
Constructs an empty list with an initial capacity of ten. |
|
GapList(Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
GapList(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
Method Summary | ||
---|---|---|
boolean |
add(E element)
Appends the specified element to the end of this list. |
|
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list. |
|
boolean |
addAll(Collection<? extends E> 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. |
|
boolean |
addAll(int index,
Collection<? extends E> c)
Inserts all of the elements in the specified Collection into this list, starting at the specified position. |
|
boolean |
addArray(int index,
Object[] elements)
|
|
boolean |
addArray(int index,
Object[] elements,
int off,
int len)
Inserts elements from the given array into this list, starting at the given index. |
|
void |
clear()
Removes all of the elements from this list. |
|
Object |
clone()
Returns a shallow copy of this GapList instance. |
|
protected void |
consistencyCheck()
Internal consistency check. |
|
protected void |
consistencyError(String s)
|
|
boolean |
contains(Object elem)
Returns true if this list contains the specified element. |
|
void |
copyElements(int startIndex,
int endIndex,
Collection<E> dest)
Copy elements of this list between the given index range to the end of the given collection. |
|
void |
copyElements(int startIndex,
int endIndex,
Object[] dest,
int destIndex)
Copy elements of this list between the given index range to the given object array. |
|
void |
copyItems(int startIndex,
int endIndex,
Object[] dest,
int destIndex)
Deprecated. use copyElements(int, int, Object[], int) which performs the same operation |
|
protected String |
dumpDetails()
|
|
static String |
dumpElements(List l)
|
|
protected String |
dumpInternals()
|
|
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. |
|
E |
get(int index)
Returns the element at the specified position in this list. |
|
int |
indexOf(Object elem)
Searches for the first occurence of the given argument, testing for equality using the equals method. |
|
boolean |
isEmpty()
Tests if this list has no elements. |
|
int |
lastIndexOf(Object elem)
Returns the index of the last occurrence of the specified object in this list. |
|
E |
remove(int index)
Removes the element at the specified position in this list. |
|
void |
remove(int index,
int count)
Removes elements at the given index. |
|
protected void |
removeRange(int fromIndex,
int toIndex)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. |
|
E |
set(int index,
E 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. |
|
void |
swap(int index1,
int index2)
Swap elements at the given indexes. |
|
Object[] |
toArray()
Returns an array containing all of the elements in this list in the correct order. |
|
|
toArray(T[] a)
Returns an array containing all of the elements in this list in the correct order; the runtime type of the returned array is that of the specified array. |
|
String |
toString()
|
|
void |
trimToSize()
Trims the capacity of this GapList instance to be the list's current size. |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, remove, removeAll, retainAll |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
Constructor Detail |
---|
public GapList(int initialCapacity)
initialCapacity
- the initial capacity of the list.
IllegalArgumentException
- if the specified initial capacity
is negativepublic GapList()
public GapList(Collection<? extends E> c)
c
- the collection whose elements are to be placed into this list.
NullPointerException
- if the specified collection is null.Method Detail |
---|
public void trimToSize()
public void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacity.public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface List<E>
isEmpty
in class AbstractCollection<E>
public boolean contains(Object elem)
contains
in interface Collection<E>
contains
in interface List<E>
contains
in class AbstractCollection<E>
elem
- element whose presence in this List is to be tested.
true
if the specified element is present;
false
otherwise.public int indexOf(Object elem)
elem
- an object.
Object.equals(Object)
public int lastIndexOf(Object elem)
lastIndexOf
in interface List<E>
lastIndexOf
in class AbstractList<E>
elem
- the desired element.
public Object clone()
public void copyItems(int startIndex, int endIndex, Object[] dest, int destIndex)
copyElements(int, int, Object[], int)
which performs the same operation
public void copyElements(int startIndex, int endIndex, Object[] dest, int destIndex)
startIndex
- start index of the region of this list to be copied.endIndex
- end index of the region of this list to be copied.dest
- collection to the end of which the items should be copied.public void copyElements(int startIndex, int endIndex, Collection<E> dest)
startIndex
- start index of the region of this list to be copied.endIndex
- end index of the region of this list to be copied.dest
- collection to the end of which the items should be copied.public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
public <T> T[] toArray(T[] a)
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
a
- the array into which the elements of the list are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.
ArrayStoreException
- if the runtime type of a is not a supertype
of the runtime type of every element in this list.public E get(int index)
index
- index of element to return.
IndexOutOfBoundsException
- if index is out of range (index
< 0 || index >= size()).public E set(int index, E element)
index
- index of element to replace.element
- element to be stored at the specified position.
IndexOutOfBoundsException
- if index out of range
(index < 0 || index >= size()).public void swap(int index1, int index2)
public boolean add(E element)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractList<E>
element
- non-null element to be appended to this list.
public void add(int index, E element)
index
- index at which the specified element is to be inserted.element
- element to be inserted.
IndexOutOfBoundsException
- if index is out of range
(index < 0 || index > size()).public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface List<E>
addAll
in class AbstractCollection<E>
c
- the elements to be inserted into this list.
NullPointerException
- if the specified collection is null.public boolean addAll(int index, Collection<? extends E> c)
index
- index at which to insert first element
from the specified collection.c
- elements to be inserted into this list.
IndexOutOfBoundsException
- if index out of range (index
< 0 || index > size()).
NullPointerException
- if the specified Collection is null.public boolean addArray(int index, Object[] elements)
public boolean addArray(int index, Object[] elements, int off, int len)
index
- index at which to insert first element.elements
- array of elements from which to insert elements.off
- offset in the elements pointing to first element to copy.len
- number of elements to copy from the elements array.public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractList<E>
public E remove(int index)
index
- the index of the element to removed.
IndexOutOfBoundsException
- if index out of range (index
< 0 || index >= size()).public void remove(int index, int count)
index
- index of the first element to be removed.count
- number of elements to remove.protected void removeRange(int fromIndex, int toIndex)
removeRange
in class AbstractList<E>
fromIndex
- index of first element to be removed.toIndex
- index after last element to be removed.protected void consistencyCheck()
protected final void consistencyError(String s)
protected String dumpDetails()
protected String dumpInternals()
public String toString()
toString
in class AbstractCollection<E>
public static String dumpElements(List l)
|
org.netbeans.modules.editor.util/1 1.17 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |