From 5ff4f56a72b372124295f8016f2c6bfdeff95e10 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 16 Oct 2015 15:10:56 +0200 Subject: [PATCH] =?utf8?q?nope,=20contains()=20did=20not=20work,=20sadly?= =?utf8?q?=20:-(=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/AddressbookSessionBean.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) 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); + } } } -- 2.39.5