Listing shows Node as a class within a package containing LinkedBag. Revise LinkedBag to use this version of Node.
LISTING 2 The class Node with package access
package BagPackage;class Node{ private T data; private Node next; Node(T dataPortion) // the constructor’s name is Node, not Node { this(dataPortion, null); } // end constructor Node(T dataPortion, Node nextNode) { data = dataPortion; next = nextNode; } // end constructor T getData() { return data; } // end getData void setData(T newData) { data = newData; } // end setData Node getNextNode() { return next; } // end getNextNode void setNextNode(Node nextNode) { next = nextNode; } // end setNextNode} // end Node
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.