public class LinkLinkedList<T>
extends java.lang.Object
implements java.util.List<T>, java.util.Deque<T>, java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
LinkLinkedList.Link<T> |
Constructor and Description |
---|
LinkLinkedList() |
Modifier and Type | Method and Description |
---|---|
void |
add(int idx,
T e) |
boolean |
add(T e) |
boolean |
addAll(java.util.Collection<? extends T> c) |
boolean |
addAll(int idx,
java.util.Collection<? extends T> c) |
void |
addFirst(T e)
Adds an element to the BEGINNING of this list
|
void |
addFirstLink(LinkLinkedList.Link<T> link)
Adds a link to the front of the list
|
LinkLinkedList.Link<T> |
addFirstLink(T e)
Adds a link to the front of the list
|
void |
addLast(T e)
Adds an element to the END of this list
|
void |
addLastLink(LinkLinkedList.Link<T> link)
Adds a link to the end of the list
|
LinkLinkedList.Link<T> |
addLastLink(T e)
Adds a link to the end of the list
|
LinkLinkedList.Link<T> |
addLink(T e)
Adds a link to the end of the list,
|
LinkLinkedList.Link<T> |
backLink()
Last link
|
LinkLinkedList.Link<T> |
begin()
First element
|
void |
clear() |
LinkLinkedList<T> |
clone()
Clones the list (shallow copy)
|
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
java.util.Iterator<T> |
descendingIterator() |
T |
element() |
LinkLinkedList.Link<T> |
end()
Past-the-end element
|
LinkLinkedList.Link<T> |
findLastLink(java.lang.Object o)
Finds the last link whose get() method
returns the specified value (in == or .equals() sense)
|
LinkLinkedList.Link<T> |
findLastLink(java.lang.Object o,
LinkLinkedList.Link<T> front,
LinkLinkedList.Link<T> end)
Finds the last link whose get() method
returns the specified value (in == or .equals() sense)
|
LinkLinkedList.Link<T> |
findLink(java.lang.Object o)
Finds the first link whose get() method
returns the specified value (in == or .equals() sense)
|
LinkLinkedList.Link<T> |
findLink(java.lang.Object o,
LinkLinkedList.Link<T> front,
LinkLinkedList.Link<T> end)
Finds the first link whose get() method
returns the specified value (in == or .equals() sense).
|
LinkLinkedList.Link<T> |
frontLink()
First link
|
T |
get(int index) |
T |
getFirst() |
T |
getLast() |
LinkLinkedList.Link<T> |
getLink(int idx)
Returns the link at the specified index
|
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int idx) |
boolean |
offer(T e) |
boolean |
offerFirst(T e) |
boolean |
offerLast(T e) |
T |
peek() |
T |
peekFirst() |
T |
peekLast() |
T |
poll() |
T |
pollFirst() |
T |
pollLast() |
T |
pop() |
void |
push(T e) |
T |
remove() |
T |
remove(int idx) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
T |
removeFirst() |
boolean |
removeFirstOccurrence(java.lang.Object o) |
T |
removeLast() |
boolean |
removeLastOccurrence(java.lang.Object o) |
void |
removeLink(LinkLinkedList.Link<T> link) |
boolean |
retainAll(java.util.Collection<?> c) |
LinkLinkedList<T> |
reversed() |
T |
set(int idx,
T element) |
int |
size() |
LinkLinkedList<T> |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
public LinkLinkedList.Link<T> begin()
public LinkLinkedList.Link<T> end()
public boolean add(T e)
public LinkLinkedList.Link<T> addLink(T e)
e
- element to addpublic LinkLinkedList.Link<T> addLastLink(T e)
e
- element to addpublic LinkLinkedList.Link<T> addFirstLink(T e)
e
- element to addpublic void addFirstLink(LinkLinkedList.Link<T> link)
link
- link to addpublic void addLastLink(LinkLinkedList.Link<T> link)
link
- link to addpublic LinkLinkedList.Link<T> frontLink()
java.util.NoSuchElementException
- if there is no linkpublic LinkLinkedList.Link<T> backLink()
java.util.NoSuchElementException
- if there is no element in the listpublic void addLast(T e)
addLast
in interface java.util.Deque<T>
e
- element to addpublic void addFirst(T e)
addFirst
in interface java.util.Deque<T>
e
- element to addpublic LinkLinkedList.Link<T> getLink(int idx)
idx
- indexpublic boolean addAll(java.util.Collection<? extends T> c)
public boolean addAll(int idx, java.util.Collection<? extends T> c)
addAll
in interface java.util.List<T>
public void removeLink(LinkLinkedList.Link<T> link)
public void clear()
public LinkLinkedList.Link<T> findLink(java.lang.Object o, LinkLinkedList.Link<T> front, LinkLinkedList.Link<T> end)
o
- object to check for equalityfront
- first link to checkend
- last link (exclusive)public LinkLinkedList.Link<T> findLink(java.lang.Object o)
o
- object to check for equalityend()
if not found.public LinkLinkedList.Link<T> findLastLink(java.lang.Object o, LinkLinkedList.Link<T> front, LinkLinkedList.Link<T> end)
o
- object to check for equalityfront
- front element (last one checked)end
- end of list (exclusive, not checked)public LinkLinkedList.Link<T> findLastLink(java.lang.Object o)
o
- object to check for equalityend()
if not found.public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<T>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<T>
public boolean isEmpty()
public java.util.Iterator<T> iterator()
public java.util.ListIterator<T> listIterator()
listIterator
in interface java.util.List<T>
public java.util.ListIterator<T> listIterator(int idx)
listIterator
in interface java.util.List<T>
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public int size()
public LinkLinkedList<T> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<T>
public java.lang.Object[] toArray()
public <E> E[] toArray(E[] a)
public java.util.Iterator<T> descendingIterator()
descendingIterator
in interface java.util.Deque<T>
public T element()
public boolean offer(T e)
public T peek()
public T poll()
public T remove()
public boolean removeFirstOccurrence(java.lang.Object o)
removeFirstOccurrence
in interface java.util.Deque<T>
public boolean removeLastOccurrence(java.lang.Object o)
removeLastOccurrence
in interface java.util.Deque<T>
public LinkLinkedList<T> clone()
clone
in class java.lang.Object
public LinkLinkedList<T> reversed()