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 2020/04/24 02:59:46 UTC

[james-project] 11/17: [Refactoring] remove OptionalUtils.toList method that is used only once

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 98be92056cbdb85dd42fda1aa7f8c73f4d4766d8
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Tue Apr 21 21:16:11 2020 +0200

    [Refactoring] remove OptionalUtils.toList method that is used only once
---
 .../util/src/main/java/org/apache/james/util/OptionalUtils.java     | 6 ------
 .../src/main/java/org/apache/james/jmap/mailet/VacationReply.java   | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/server/container/util/src/main/java/org/apache/james/util/OptionalUtils.java b/server/container/util/src/main/java/org/apache/james/util/OptionalUtils.java
index 3fdc62f..5224ac7 100644
--- a/server/container/util/src/main/java/org/apache/james/util/OptionalUtils.java
+++ b/server/container/util/src/main/java/org/apache/james/util/OptionalUtils.java
@@ -24,7 +24,6 @@ import java.util.function.BiPredicate;
 import java.util.function.Supplier;
 import java.util.stream.Stream;
 
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 
 public class OptionalUtils {
@@ -41,11 +40,6 @@ public class OptionalUtils {
         return optional;
     }
 
-    public static <T> ImmutableList<T> toList(Optional<T> optional) {
-        return optional.map(ImmutableList::of)
-            .orElse(ImmutableList.of());
-    }
-
     public static <T> ImmutableSet<T> toSet(Optional<T> optional) {
         return optional.map(ImmutableSet::of)
             .orElse(ImmutableSet.of());
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/VacationReply.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/VacationReply.java
index 1c87e4d..70f55b9 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/VacationReply.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/mailet/VacationReply.java
@@ -27,7 +27,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.james.core.MailAddress;
 import org.apache.james.jmap.api.vacation.Vacation;
 import org.apache.james.jmap.draft.utils.MimeMessageBodyGenerator;
-import org.apache.james.util.OptionalUtils;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.AutomaticallySentMailDetector;
 
@@ -70,7 +69,7 @@ public class VacationReply {
             Preconditions.checkState(mailRecipient != null, "Original recipient address should not be null");
             Preconditions.checkState(originalMail.hasSender(), "Original sender address should not be null");
 
-            return new VacationReply(mailRecipient, OptionalUtils.toList(originalMail.getMaybeSender().asOptional()), generateMimeMessage(mimeMessageBodyGenerator));
+            return new VacationReply(mailRecipient, originalMail.getMaybeSender().asList(), generateMimeMessage(mimeMessageBodyGenerator));
         }
 
         private MimeMessage generateMimeMessage(MimeMessageBodyGenerator mimeMessageBodyGenerator) throws MessagingException {


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