public class IntNode
extends java.lang.Object
Constructor and Description |
---|
IntNode(int initialData,
IntNode initialLink)
Initialize a node with a specified initial data and link to the next
node.
|
Modifier and Type | Method and Description |
---|---|
int |
getData()
Accessor method to get the data from this node.
|
IntNode |
getLink()
Accessor method to get a reference to the next node after this node.
|
void |
setData(int newData)
Modification method to set the data in this node.
|
void |
setLink(IntNode newLink)
Modification method to set the link to the next node after this node.
|
public IntNode(int initialData, IntNode initialLink)
initialData
- the initial data of this new nodeinitialLink
- a reference to the node after this new node--this reference may be null
to indicate that there is no node after this new node.public int getData()
-
- nonepublic IntNode getLink()
-
- nonepublic void setData(int newData)
newData
- the new data to place in this nodepublic void setLink(IntNode newLink)
newLink
- a reference to the node that should appear after this node in the linked
list (or the null reference if there is no node after this node)