public class LinkedList extends List
| Modifier and Type | Field and Description |
|---|---|
protected org.ws4d.java.structures.LinkedList.Entry |
header |
| Constructor and Description |
|---|
LinkedList()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object obj)
Adds element between the previous and the old element at the specified index position.
|
boolean |
add(java.lang.Object obj)
Adds object at the end of the linked list
|
boolean |
addAll(DataStructure c)
Add all elements within the data structure at the end of the linked list.
|
boolean |
addAll(int index,
DataStructure data)
Add all elements of the given data structure into the list.
|
void |
addFirst(java.lang.Object o)
Adds the given element at the beginning of this list.
|
void |
clear()
Removes all of the elements from this list.
|
java.lang.Object |
get(int index) |
java.lang.Object |
getFirst()
Returns the first element in this list.
|
java.lang.Object |
getLast()
Returns the last element in this list.
|
Iterator |
iterator()
Returns an iterator over all items stored within this data structure instance.
|
ListIterator |
listIterator(int index)
Returns a list iterator of the list.
|
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list.
|
java.lang.Object |
removeFirst()
Removes the first element of list and returns it.
|
java.lang.Object |
removeLast()
Removes and returns the last element from this list.
|
java.lang.Object |
set(int index,
java.lang.Object element) |
java.lang.Object[] |
toArray()
Returns an array containing all items stored within this data structure.
|
java.lang.Object[] |
toArray(java.lang.Object[] array)
Fills array with the elements of this list.
|
equals, getClassShortName, hashCode, indexOf, lastIndexOf, listIterator, size, subListcontains, containsAll, isEmpty, remove, toStringpublic void add(int index,
java.lang.Object obj)
throws java.lang.IndexOutOfBoundsException
public boolean add(java.lang.Object obj)
public boolean addAll(DataStructure c)
addAll in class Listc - elements to add.true if at least one object from data was actually added, i.e. a modification
was made to this instance, false in any other case (e.g. adding objects to a set which already
contains them in terms of java.lang.Object.equals(Object))public boolean addAll(int index,
DataStructure data)
throws java.lang.IndexOutOfBoundsException
public void addFirst(java.lang.Object o)
o - element to add.public void clear()
clear in class DataStructurepublic java.lang.Object get(int index)
throws java.lang.IndexOutOfBoundsException
public java.lang.Object getFirst()
public java.lang.Object getLast()
public Iterator iterator()
DataStructurepublic ListIterator listIterator(int index) throws java.lang.IndexOutOfBoundsException
listIterator in class Listindex - index to start.java.lang.IndexOutOfBoundsException - thrown if (index < 0) or (index > size)public java.lang.Object remove(int index)
throws java.lang.IndexOutOfBoundsException
public java.lang.Object removeFirst()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - thrown if no element is in listpublic java.lang.Object removeLast()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic java.lang.Object set(int index,
java.lang.Object element)
throws java.lang.IndexOutOfBoundsException
public java.lang.Object[] toArray()
DataStructureDataStructure.size(), i.e. for an empty data structure an array of length zero is returned
(rather than null).toArray in class DataStructurenullpublic java.lang.Object[] toArray(java.lang.Object[] array)
toArray in class DataStructurearray - the array to store this data structure's content to