예제 #1
0
 /**
  * Adds condiments to the potato.
  *
  * @param names Names of the condiments to add
  */
 public void addCondiments(String... names) throws NotDeliciousException {
   for (String condimentName : names) {
     Condiment condiment = new Condiment(condimentName, true);
     if (!condiment.isDelicious()) throw new NotDeliciousException();
     this.getCondiments().add(condiment);
   }
 }
예제 #2
0
 /**
  * Prints the names of the condiments on this potato to stdout.
  *
  * @see #getCondiments()
  */
 public void listCondiments() {
   for (Condiment condiment : this.getCondiments()) {
     System.out.println(condiment.getName());
   }
 }