E
- the type of linked listpublic class LinkedList<E> extends Object
Constructor and Description |
---|
LinkedList()
Creates a new linked list.
|
Modifier and Type | Method and Description |
---|---|
LinkedListNode<E> |
addFirst(E object)
Adds an object to the beginning of the list by automatically creating a
a new node and adding it to the beginning of the list.
|
LinkedListNode<E> |
addFirst(LinkedListNode<E> node)
Adds a node to the beginning of the list.
|
LinkedListNode<E> |
addLast(E object)
Adds an object to the end of the list by automatically creating a
a new node and adding it to the end of the list.
|
LinkedListNode<E> |
addLast(LinkedListNode<E> node)
Adds a node to the end of the list.
|
void |
clear()
Erases all elements in the list and re-initializes it.
|
LinkedListNode<E> |
getFirst()
Returns the first linked list node in the list.
|
LinkedListNode<E> |
getLast()
Returns the last linked list node in the list.
|
String |
toString()
Returns a String representation of the linked list with a comma
delimited list of all the elements in the list.
|
public LinkedListNode<E> getFirst()
public LinkedListNode<E> getLast()
public LinkedListNode<E> addFirst(LinkedListNode<E> node)
node
- the node to add to the beginning of the list.public LinkedListNode<E> addFirst(E object)
object
- the object to add to the beginning of the list.public LinkedListNode<E> addLast(LinkedListNode<E> node)
node
- the node to add to the beginning of the list.public LinkedListNode<E> addLast(E object)
object
- the object to add to the end of the list.public void clear()
Copyright © 2003–2020 Ignite Realtime. All rights reserved.