public class LinkedList extends Object
Title: 常用代码打包
Description: Simple LinkedList implementation. The main feature is that list nodes are public, which allows very fast delete operations when one has a reference to the node that is to be deleted.
Copyright: Copyright (c) 2006
Company: www.justdos.net
| 构造器和说明 |
|---|
LinkedList()
Creates a new linked list.
|
| 限定符和类型 | 方法和说明 |
|---|---|
LinkedListNode |
addFirst(LinkedListNode node)
Adds a node to the beginning of the list.
|
LinkedListNode |
addFirst(Object 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 |
addLast(Object 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.
|
void |
clear()
Erases all elements in the list and re-initializes it.
|
LinkedListNode |
getFirst()
Returns the first linked list node in the list.
|
LinkedListNode |
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 getFirst()
public LinkedListNode getLast()
public LinkedListNode addFirst(LinkedListNode node)
node - the node to add to the beginning of the list.public LinkedListNode addFirst(Object object)
object - the object to add to the beginning of the list.public LinkedListNode addLast(Object object)
object - the object to add to the end of the list.public void clear()
Copyright © 2023 onecode. All rights reserved.