Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Node<T> {
- private T value;
- private Node<T> next;
- public Node(T x) {
- this.value = x;
- }
- public Node(T x, Node<T> next) {
- this.value = x;
- this.next = next;
- }
- public T getValue() {
- return this.value;
- }
- public Node<T> getNext(){
- return this.next;
- }
- public boolean hasNext() {
- return this.next != null;
- }
- public void setValue(T x) {
- this.value = x;
- }
- public void setNext(Node<T> next) {
- this.next = next;
- }
- @Override
- public String toString() {
- return "Node with value: "+value.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement