コード例 #1
0
 public int sumOfStock(IngredientNode n) {
   if (n == null) {
     return 0;
   } else {
     return n.getIngredient().getStock() + sumOfStock(n.getNext());
   }
 }
コード例 #2
0
 public String printData() {
   IngredientNode current = header;
   String s = "";
   while (current != null) {
     s = s + "\n" + current.getIngredient();
     current = current.getNext();
   }
   return s;
 }