|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.timeindexing.util.DoubleLinkedList
A doubly linked list. This is similar to java.util.LinkedList but it keeps its own current position. This allows access to consecutive nodes to be faster, particularly in large lists. LinkedList always starts a getItem() at node 0.
Constructor Summary | |
DoubleLinkedList()
Construct a DoubleLinkedList. |
Method Summary | |
void |
add(long index,
java.lang.Object element)
Inserts the specified element at the specified position in this list. |
boolean |
add(java.lang.Object o)
Appends the specified element to the end of this list. |
void |
addFirst(java.lang.Object o)
Inserts the given element at the beginning of this list. |
void |
addLast(java.lang.Object o)
Appends the given element to the end of this list. |
void |
clear()
Removes all of the elements from this list. |
java.lang.Object |
get(long index)
Returns the element at the specified position in this list. |
java.lang.Object |
getFirst()
Returns the first element in this list. |
java.lang.Object |
getLast()
Returns the last element in this list. |
long |
indexOf(java.lang.Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element. |
long |
lastIndexOf(java.lang.Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element. |
java.lang.Object |
remove(long index)
Removes the element at the specified position in this list. |
boolean |
remove(java.lang.Object o)
Removes the first occurrence of the specified element in this list. |
java.lang.Object |
removeFirst()
Removes and returns the first element from this list. |
java.lang.Object |
removeLast()
Removes and returns the last element from this list. |
java.lang.Object |
set(long index,
java.lang.Object element)
Replaces the element at the specified position in this list with the specified element. |
long |
size()
Returns the number of elements in this list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DoubleLinkedList()
Method Detail |
public java.lang.Object getFirst()
java.util.NoSuchElementException
- if this list is empty.public java.lang.Object getLast()
java.util.NoSuchElementException
- if this list is empty.public java.lang.Object removeFirst()
java.util.NoSuchElementException
- if this list is empty.public java.lang.Object removeLast()
java.util.NoSuchElementException
- if this list is empty.public void addFirst(java.lang.Object o)
o
- the element to be inserted at the beginning of this list.public void addLast(java.lang.Object o)
o
- the element to be inserted at the end of this list.public long size()
public boolean add(java.lang.Object o)
o
- element to be appended to this list.
public boolean remove(java.lang.Object o)
o
- element to be removed from this list, if present.
public void clear()
public java.lang.Object get(long index)
index
- index of element to return.
java.lang.IndexOutOfBoundsException
- if the specified index is is out of
range (index < 0 || index >= size()).public java.lang.Object set(long index, java.lang.Object element)
index
- index of element to replace.element
- element to be stored at the specified position.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public void add(long index, java.lang.Object element)
index
- index at which the specified element is to be inserted.element
- element to be inserted.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index > size()).public java.lang.Object remove(long index)
index
- the index of the element to removed.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public long indexOf(java.lang.Object o)
o
- element to search for.
public long lastIndexOf(java.lang.Object o)
o
- element to search for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |