public MailInAdapterResult findMail(Mail mail){
  int indexPosition=Collections.binarySearch(items,mail,MailComparator.INSTANCE);
  boolean containsMail=false;
  Mail found=null;
  if (indexPosition < 0) {
    indexPosition=~indexPosition;
  }
 else {
    found=items.get(indexPosition);
    if (found.getId() == mail.getId()) {
      containsMail=true;
    }
 else {
      containsMail=false;
      found=null;
    }
  }
  return new MailInAdapterResult(containsMail,found,indexPosition);
}

public MailInAdapterResult findMail ( Mail mail ) { int indexPosition = Collections . binarySearch ( items , mail , MailComparator . INSTANCE ) ; boolean containsMail = false ; Mail found = null ; if ( indexPosition < 0 ) { indexPosition = ~ indexPosition ; } else { found = items . get ( indexPosition ) ; if ( found . getId ( ) == mail . getId ( ) ) { containsMail = true ; } else { containsMail = false ; found = null ; } } return new MailInAdapterResult ( containsMail , found , indexPosition ) ; }
searches for an equal mail ( compares mail id ) in the adapter .
