From: Roland Haeder Date: Fri, 16 Oct 2015 13:10:56 +0000 (+0200) Subject: nope, contains() did not work, sadly :-( X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5ff4f56a72b372124295f8016f2c6bfdeff95e10;p=jfinancials-mailer-ejb.git nope, contains() did not work, sadly :-( Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java b/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java index 1888db0..4d2869d 100644 --- a/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java +++ b/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java @@ -116,14 +116,32 @@ public class AddressbookSessionBean extends BaseDatabaseBean implements Addressb // Log message this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0}", u)); //NOI18N - // Is this user not included? - if (!allSharees.contains(u)) { - // Found one to add! - // Log message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0} - ADDING!", u)); //NOI18N - - // Add it - userList.add(u); + // Some entries in allSharees? + if (!allSharees.isEmpty()) { + // Default is not found + boolean isFound = false; + + // Check all entries (user name matching) + for (final User sharee : allSharees) { + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: sharee={0}", sharee)); + + // Does it match? + if (sharee.equals(u)) { + // Skip this one + isFound = true; + break; + } + } + + // Still not found? + if (!isFound) { + // Found one to add + this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0} - ADDING!", u)); //NOI18N + + // Add it + userList.add(u); + } } }