@Deprecated
    public static Optional<Email> getPrimaryOrFirstEmail(User user) {
        for (Email email : user.getEmails()) {
            if (email.isPrimary()) {
                return Optional.of(email);
            }
        }

        if (user.getEmails().size() > 0) {
            return Optional.of(user.getEmails().get(0));
        }
        return Optional.absent();
    }
@ Deprecated public static Optional < Email > getPrimaryOrFirstEmail ( User user ) { for ( Email email : user . getEmails ( ) ) { if ( email . isPrimary ( ) ) { return Optional . of ( email ) ; } } if ( user . getEmails ( ) . size ( ) > 0 ) { return Optional . of ( user . getEmails ( ) . get ( 0 ) ) ; } return Optional . absent ( ) ; }
try to extract an email from the User.
If the User has a primary email address this email will be returned.
If not the first email address found will be returned.
If no Email has been found email.isPresent() == false

@param user a {@link User} with a possible email
@return an email if found
@deprecated Please use the method {@link User#getPrimaryOrFirstEmail()}. Will be removed in 1.11 or 2.0.