Class Node<E>


  • public class Node<E>
    extends java.lang.Object
    A simple class to represent a linked list node.
    Version:
    1.1
    Author:
    Rui Meireles
    • Constructor Summary

      Constructors 
      Constructor Description
      Node​(E value)
      Constructs a new node with the value passed in as an argument and a null next reference.
      Node​(E value, Node<E> next)
      Constructs a new node with the value passed in as an argument and a next reference to a node passed as an argument.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Node<E> getNext()
      Returns the next reference stored in this node, which represents the next node on the linked list.
      E getValue()
      Returns the value stored inside this node.
      void setNext​(Node<E> next)
      Sets this node's next reference, which represents the next node on the linked list, to the value passed as an argument.
      void setValue​(E value)
      Sets the value of this node to the value passed as an argument.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Node

        public Node​(E value,
                    Node<E> next)
        Constructs a new node with the value passed in as an argument and a next reference to a node passed as an argument.
        Parameters:
        value - the value to store in the node.
        next - the node coming next on the list.
      • Node

        public Node​(E value)
        Constructs a new node with the value passed in as an argument and a null next reference.
        Parameters:
        value - the value to store in the node.
    • Method Detail

      • getValue

        public E getValue()
        Returns the value stored inside this node.
        Returns:
        the value stored inside this node.
      • setValue

        public void setValue​(E value)
        Sets the value of this node to the value passed as an argument.
        Parameters:
        value - value to be stored inside this node.
      • getNext

        public Node<E> getNext()
        Returns the next reference stored in this node, which represents the next node on the linked list.
        Returns:
        the next reference stored in this node.
      • setNext

        public void setNext​(Node<E> next)
        Sets this node's next reference, which represents the next node on the linked list, to the value passed as an argument.
        Parameters:
        next - next node reference to be stored in the node.