0% found this document useful (0 votes)
20 views2 pages

Node T

The document defines a Node class that represents a node in a linked list. The Node class has fields to store a value and a reference to the next node. It also contains getter, setter, and other methods to access and manipulate the value and next fields.

Uploaded by

Elai Grisaru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Node T

The document defines a Node class that represents a node in a linked list. The Node class has fields to store a value and a reference to the next node. It also contains getter, setter, and other methods to access and manipulate the value and next fields.

Uploaded by

Elai Grisaru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

/* The class IntNode **/

public class Node<T>

private T value; // IntNode value

private Node<T> next; // next IntNode

/* Constructor - returns a IntNode with "value" as value and without successesor IntNode
**/

public Node(T value)

this.value = value;

this.next = null;

/* Constructor - returns a IntNode with "value" as value and its successesor is "next" **/

public Node(T value, Node<T> next)

this.value = value;

this.next = next;

/* Returns the IntNode "value" **/

public T getValue()

return this.value;

/* Returns the IntNode "next" IntNode **/

public Node<T> getNext()

{
return this.next;

/* Return if the current IntNode has successor **/

public boolean hasNext()

return (this.next != null);

/* set the value attribute to be "value" **/

public void setValue(T value)

this.value = value;

/* set the next attribute to be "next" **/

public void setNext(Node<T> next)

this.next = next;

/* Returns a String that describes the IntNode (and its' successesors **/

public String toString()

return value + " --> " + next;

You might also like