Example #1
0
 public List<Contact> search(String name) {
   List<Contact> ret = new ArrayList<>();
   for (Contact c : list) {
     if (c.getFirstName().equals(name)) {
       ret.add(c);
     }
   }
   return ret;
 }
Example #2
0
 public void edit(Contact toEdit, String[] args) {
   switch (args[0]) {
     case "firstname":
       toEdit.setFirstName(args[1]);
       break;
     case "surname":
       toEdit.setSurName(args[1]);
       break;
     case "number":
       toEdit.setNumber(args[1]);
       break;
     default:
       break;
   }
 }