@Override public void updatePerson(Person personToUpdate) { Person person = this.lookupPerson(personToUpdate.getLastName()); if (person != null) { person.setFirstName(personToUpdate.getFirstName()); } }
@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; }