]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 1 Apr 2020 18:20:51 +0000 (20:20 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2020 16:34:35 +0000 (18:34 +0200)
- rewrote to avoid local Iterator<Foo> instance

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jcontacts/model/contact/JobsContactSessionBean.java

index 1cd6fdf5860fb3eb687f6cd45043081c5aacf8b7..77180126554e9a2f51b827a267216a1c2893bf79 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.jcontacts.model.contact;
 
 import java.text.MessageFormat;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
 import javax.ejb.Stateless;
@@ -98,21 +97,15 @@ public class JobsContactSessionBean extends BaseJobsEnterpriseBean implements Co
                        return null;
                }
 
-               // Get iterator
-               final Iterator<Contact> iterator = contacts.iterator();
-
                // Loop through all
-               while (iterator.hasNext()) {
-                       // Get contact
-                       final Contact next = iterator.next();
-
+               for (final Contact currentContact : contacts) {
                        // Is same contact?
-                       if ((Objects.equals(contact, next)) || (Contacts.isSameContact(contact, next))) {
+                       if ((Objects.equals(contact, currentContact)) || (Contacts.isSameContact(contact, currentContact))) {
                                // Debug message
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isContactFound: Found same contact: contactId={1}", this.getClass().getSimpleName(), next.getContactId())); //NOI18N
+                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isContactFound: Found same contact: contactId={1}", this.getClass().getSimpleName(), currentContact.getContactId())); //NOI18N
 
                                // Found it
-                               foundContact = next;
+                               foundContact = currentContact;
                                break;
                        }
                }