Example usage for javax.mail.internet InternetAddress equals

List of usage examples for javax.mail.internet InternetAddress equals

Introduction

In this page you can find the example usage for javax.mail.internet InternetAddress equals.

Prototype

@Override
public boolean equals(Object a) 

Source Link

Document

The equality operator.

Usage

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;
}