Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GroceryListLinked implements IGroceryList {
- GroceryNode head = null;
- int size = 0;
- GroceryListLinked() {}
- public boolean add(GroceryItem item) {
- GroceryNode newNode;
- newNode= new GroceryNode(item,null);
- newNode.setSuccessor(head.getSuccessor());
- head.setSuccessor = newNode;
- size++;
- return false;
- }
- public boolean remove(String name) {
- return false;
- }
- public boolean markAsBought(String name) {
- return false;
- }
- public void display() {
- }
- }
- class GroceryNode {
- GroceryItem data;
- GroceryNode next;
- GroceryNode(GroceryItem data, GroceryNode next) {
- this.data = data;
- this.next = next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement