You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/16 01:18:35 UTC
[james-project] 05/11: [PERF] FetchGroupConverter can optimize single element
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 c295b24ada4f8084ca4e3cd0d73f375a403a0072
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 11 08:49:36 2022 +0700
[PERF] FetchGroupConverter can optimize single element
---
.../org/apache/james/mailbox/store/mail/FetchGroupConverter.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/FetchGroupConverter.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/FetchGroupConverter.java
index 1b70241..112775c 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/FetchGroupConverter.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/FetchGroupConverter.java
@@ -20,6 +20,7 @@
package org.apache.james.mailbox.store.mail;
import java.util.Collection;
+import java.util.EnumSet;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.james.mailbox.model.FetchGroup;
@@ -37,7 +38,12 @@ public class FetchGroupConverter {
return MessageMapper.FetchType.FULL;
}
- Collection<MessageMapper.FetchType> fetchTypes = group.profiles()
+ EnumSet<Profile> profiles = group.profiles();
+ if (profiles.size() == 1) {
+ return toFetchType(profiles.iterator().next());
+ }
+
+ Collection<MessageMapper.FetchType> fetchTypes = profiles
.stream()
.map(FetchGroupConverter::toFetchType)
.collect(ImmutableList.toImmutableList());
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org