public Collection<Owner> findOwners(String lastName) throws ServiceException { ArrayList<Owner> found = new ArrayList<Owner>(); for (Owner owner : OWNERS.values()) { if ((owner.getLastName() != null) && (owner.getLastName().equals(lastName))) { found.add(owner); } } return found; }
static { for (int i = 1; i <= 9; i++) { Owner owner = new Owner(); owner.setId(i); owner.setAddress(String.format("address %s", i)); owner.setCity(String.format("city %s", i)); owner.setFirstName("Owner"); owner.setLastName(String.format("%tA", new GregorianCalendar(2000, 1, i))); owner.setTelephone(String.format("%1$s%1$s%1$s-%1$s%1$s%1$s-%1$s%1$s%1$s%1$s", i)); OWNERS.put(i, owner); } }
public void storeOwner(Owner owner) throws ServiceException { OWNERS.put(owner.getId(), owner); }