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