You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2016/09/15 10:08:57 UTC

[16/17] james-project git commit: MAILET-124 Simplify AND composite matcher

MAILET-124 Simplify AND composite matcher


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8c4d0139
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8c4d0139
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8c4d0139

Branch: refs/heads/master
Commit: 8c4d01393998934f47cf14bb177911301328a4a6
Parents: 028dc50
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Sep 12 15:07:59 2016 +0200
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Sep 15 12:07:44 2016 +0200

----------------------------------------------------------------------
 .../apache/james/mailetcontainer/impl/matchers/And.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8c4d0139/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/And.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/And.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/And.java
index f556a73..3d5e7e7 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/And.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/And.java
@@ -20,12 +20,12 @@ package org.apache.james.mailetcontainer.impl.matchers;
  ****************************************************************/
 
 import java.util.Collection;
-import java.util.List;
 import java.util.Set;
 
-import org.apache.mailet.MailAddress;
-import org.apache.mailet.Mail;
 import javax.mail.MessagingException;
+
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 
 import com.google.common.collect.ImmutableList;
@@ -46,11 +46,11 @@ public class And extends GenericCompositeMatcher {
      *         child Matchers.
      */
     public Collection<MailAddress> match(final Mail mail) throws MessagingException {
-        List<Set<MailAddress>> individualMatchedResults = performMatchOnMatchers(mail);
+        ImmutableList<Set<MailAddress>> individualMatchedResults = performMatchOnMatchers(mail);
         return computeIntersection(individualMatchedResults);
     }
 
-    private Set<MailAddress> computeIntersection(List<Set<MailAddress>> individualMatchedResults) {
+    private Set<MailAddress> computeIntersection(ImmutableList<Set<MailAddress>> individualMatchedResults) {
         if (individualMatchedResults.size() == 0) {
             return ImmutableSet.of();
         }
@@ -61,7 +61,7 @@ public class And extends GenericCompositeMatcher {
             computeIntersection(individualMatchedResults.subList(1, individualMatchedResults.size())));
     }
 
-    private List<Set<MailAddress>> performMatchOnMatchers(Mail mail) throws MessagingException {
+    private ImmutableList<Set<MailAddress>> performMatchOnMatchers(Mail mail) throws MessagingException {
         ImmutableList.Builder<Set<MailAddress>> builder = ImmutableList.builder();
         for (Matcher matcher : getMatchers()) {
             Collection<MailAddress> matchedMailAddress = matcher.match(mail);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org