Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. class GroceryListLinked implements IGroceryList {
  2.  
  3.   GroceryNode head = null;
  4.   int size = 0;
  5.  
  6.   GroceryListLinked() {}
  7.  
  8.   public boolean add(GroceryItem item) {
  9.  
  10.     GroceryNode newNode;
  11.     newNode= new GroceryNode(item,null);
  12.     newNode.setSuccessor(head.getSuccessor());
  13.     head.setSuccessor = newNode;
  14.     size++;
  15.    
  16.     return false;
  17.   }
  18.  
  19.   public boolean remove(String name) {
  20.    
  21.    
  22.     return false;
  23.   }
  24.  
  25.   public boolean markAsBought(String name) {
  26.     return false;
  27.   }
  28.  
  29.   public void display() {
  30.    
  31.   }
  32. }
  33.  
  34. class GroceryNode {
  35.   GroceryItem data;
  36.   GroceryNode next;
  37.  
  38.   GroceryNode(GroceryItem data, GroceryNode next) {
  39.     this.data = data;
  40.     this.next = next;
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement