public class Node
extends java.lang.Object
Node
for a linked list.Constructor and Description |
---|
Node()
Empty constructor.
|
Node(int data)
Convenience constructor.
|
Node(int data,
Node next)
Default constructor.
|
Node(Node next)
Convenience constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getData()
Get the data stored in the
Node . |
Node |
getNext()
Get the following
Node . |
void |
setNext(Node next)
Set the following
Node . |
java.lang.String |
toString()
Create a
String representation of the Node . |
public Node()
Node
with no Node
after.public Node(int data)
Node
with the given data and no following
Node
.data
- the data to store in the Node
public Node(Node next)
Node
with the given Node
following.next
- the Node
afterpublic Node(int data, Node next)
Node
with the given data and following
Node
.data
- the data to store in the Node
next
- the Node
afterpublic int getData()
Node
.public Node getNext()
Node
.Node
public void setNext(Node next)
Node
.next
- the new Node
to followpublic java.lang.String toString()
String
representation of the Node
.toString
in class java.lang.Object
Node
as a String