예제 #1
0
 @Override
 public void updatePerson(Person personToUpdate) {
   Person person = this.lookupPerson(personToUpdate.getLastName());
   if (person != null) {
     person.setFirstName(personToUpdate.getFirstName());
   }
 }
예제 #2
0
 @Override
 public Person lookupPerson(String name) {
   logger.info("try to find person with last name: " + name);
   Person personToReturn = null;
   synchronized (persons) {
     for (Person person : persons) {
       if (person.getLastName().equals(name)) {
         personToReturn = person;
         break;
       }
     }
   }
   return personToReturn;
 }