コード例 #1
0
 public void addHobby(String title, String description) {
   Hobby hobby = new Hobby(title, description);
   if (contact.getHobbies().contains(hobby)) {
     System.out.println("This contact already has such hobby");
   } else {
     contact.getHobbies().add(hobby);
   }
 }
コード例 #2
0
 public void addPlace(String title, String description, double longitude, double latitude) {
   Place place = new Place(title, longitude, latitude, description);
   if (contact.getPlaces().contains(place)) {
     System.out.println("This contact already has such place");
   } else {
     contact.getPlaces().add(place);
   }
 }
コード例 #3
0
 public void createContact(String login, String firstName, String lastName, LocalDate birthDate) {
   // contact = new Contact(login, firstName, lastName, birthDate);
   if (contactDao.getContactMap().containsKey(login)) {
     System.out.println("This login isn't unique! Enter unique login");
   } else {
     contact.setLogin(login);
   }
   contact.setFirstName(firstName);
   contact.setLastName(lastName);
   contact.setBirthDate(birthDate);
   contactDao.addContact(contact);
 }