List of usage examples for javax.mail.internet InternetAddress equals
@Override public boolean equals(Object a)
From source file:org.openmhealth.dsu.service.EndUserServiceImpl.java
@Override @Transactional(readOnly = true)//from w ww . j a v a 2 s .c o m public boolean doesEmailExist(String emailAddress) { // Iterate through the existing users and check for duplicate e-mail addresses Iterator usrItr = endUserRepository.findAll().iterator(); boolean res = false; InternetAddress address = null; try { address = new InternetAddress(emailAddress); } catch (AddressException e) { res = true; } while (usrItr.hasNext() && !res) { EndUser user = (EndUser) usrItr.next(); res = address.equals(user.getEmailAddress()); } return res; }