/** * Gets the first repetition for <b>contact</b> (Details for human/organization for support), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * Contact details for an organization or a particular human that is responsible for the device * </p> */ public ContactDt getContactFirstRep() { if (getContact().isEmpty()) { return addContact(); } return getContact().get(0); } /**
/** * Adds and returns a new value for <b>contact</b> (Details for human/organization for support) * * <p> * <b>Definition:</b> * Contact details for an organization or a particular human that is responsible for the device * </p> */ public ContactDt addContact() { ContactDt newType = new ContactDt(); getContact().add(newType); return newType; }
private void updateUserDevices(final String username, Collection<Device> devices, Collection<String> contacts) { // put all the device contact info in the list and then filter out the ones in the given devices collection. devices.stream() .filter(d -> !contacts.contains(d.getContact())) .forEach(MyService::delete); } private void delete(Device d) { String contact = d.getContact(); if (d.isEmail()) { deleteEmail(contact); } else { deleteSms(contact); } } private void deleteEmail(String email) {} private void deleteSms(String sms) {}