public interface LinkedList<T>
Modifier and Type | Method and Description |
---|---|
void |
addHead(LinkedListNode<T> listNode)
Add a node to the beginning of the list.
|
void |
addTail(LinkedListNode<T> listNode)
Add a node to the end of the list.
|
boolean |
contains(T object)
Is the object on the list?
|
LinkedListNode<T> |
getHead()
Get the node at the head of the list.
|
int |
getLength() |
LinkedListNode<T> |
getNext(LinkedListNode<T> listNode)
Get the node after listNode.
|
LinkedListNode<T> |
getPrev(LinkedListNode<T> listNode)
Get the node before listNode.
|
LinkedListNode<T> |
getTail()
Get the node at the end of the list.
|
void |
insertAfter(LinkedListNode<T> listNode,
LinkedListNode<T> addNode)
Add a node after a node that is already on the list.
|
void |
insertBefore(LinkedListNode<T> listNode,
LinkedListNode<T> addNode)
Add a node before a node that is already on the list.
|
boolean |
isEmpty()
Is the list empty?
|
void |
remove(LinkedListNode<T> listNode)
Remove the listNode from the list.
|
void |
remove(T object)
Remove the object from the list.
|
LinkedListNode<T> |
removeHead()
Remove and return the LinkedListNode that is at the head of the list.
|
LinkedListNode<T> |
removeTail()
Remove and return the LinkedListNode that is at the end of the list.
|
int getLength()
void addTail(LinkedListNode<T> listNode)
listNode
- The node to add to the list.IllegalStateException
- if the node is already on the list.void addHead(LinkedListNode<T> listNode)
listNode
- The node to add to the list.IllegalStateException
- if the node is already on the list.void insertAfter(LinkedListNode<T> listNode, LinkedListNode<T> addNode)
listNode
- The node that is on the list.addNode
- The node to add.IllegalStatexception
- if listNode is not on list or addNode is already on list.void insertBefore(LinkedListNode<T> listNode, LinkedListNode<T> addNode)
listNode
- The node that is on the list.addNode
- The node to add.IllegalStatexception
- if listNode is not on list or addNode is already on list.LinkedListNode<T> removeTail()
LinkedListNode<T> removeHead()
void remove(LinkedListNode<T> listNode)
listNode
- The node to remove.void remove(T object)
object
- The object to remove.LinkedListNode<T> getHead()
LinkedListNode<T> getTail()
LinkedListNode<T> getNext(LinkedListNode<T> listNode)
listNode
- The current node.IllegalStateException
- if listNode is not on the list.LinkedListNode<T> getPrev(LinkedListNode<T> listNode)
listNode
- The current node.IllegalStateException
- if listNode is not on the list.boolean isEmpty()
boolean contains(T object)
object
- The object.Copyright © 2014. All Rights Reserved.