/** * Return the Pet with the given name, or null if none found for this Owner. * * @param name to test * @return true if pet name is already in use */ public Pet getPet(String name, boolean ignoreNew) { name = name.toLowerCase(); for (Pet pet : getPetsInternal()) { if (!ignoreNew || !pet.isNew()) { String compName = pet.getName(); compName = compName.toLowerCase(); if (compName.equals(name)) { return pet; } } } return null; }
public void addPet(Pet pet) { getPetsInternal().add(pet); pet.setOwner(this); }