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 d4dd474c4bab4bbc9d23a59386603a039ea69538 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Thu Jul 16 11:26:54 2020 +0700 [REFACTORING] Remove unused methods in MessageResultUtils --- .../imap/processor/fetch/MessageResultUtils.java | 58 ---------------------- .../fetch/MailboxMessageResultUtilsTest.java | 4 +- 2 files changed, 3 insertions(+), 59 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java index 2778747..143dcd8 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MessageResultUtils.java @@ -20,7 +20,6 @@ package org.apache.james.imap.processor.fetch; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -58,34 +57,6 @@ public class MessageResultUtils { * @return <code>List</code> of <code>MessageResult.Header</code>'s, in * their natural order */ - public static List<Header> getMatching(String[] names, Iterator<Header> iterator) { - final List<Header> results = new ArrayList<>(20); - if (iterator != null) { - while (iterator.hasNext()) { - Header header = iterator.next(); - final String headerName = header.getName(); - if (headerName != null) { - if (Arrays.stream(names) - .anyMatch(headerName::equalsIgnoreCase)) { - results.add(header); - } - } - } - } - return results; - } - - /** - * Gets header lines whose header names matches (ignoring case) any of those - * given. - * - * @param names - * header names to be matched, not null - * @param iterator - * {@link Header} <code>Iterator</code> - * @return <code>List</code> of <code>MessageResult.Header</code>'s, in - * their natural order - */ public static List<Header> getMatching(Collection<String> names, Iterator<Header> iterator) { return matching(names, iterator, false); } @@ -153,33 +124,4 @@ public class MessageResultUtils { } return result; } - - /** - * Gets header lines whose header name fails to match (ignoring case) all of - * the given names. - * - * @param names - * header names, not null - * @param iterator - * {@link Header} <code>Iterator</code> - * @return <code>List</code> of <code>@MessageResult.Header</code>'s, in - * their natural order - */ - public static List<Header> getNotMatching(String[] names, Iterator<Header> iterator) { - final List<Header> results = new ArrayList<>(20); - if (iterator != null) { - while (iterator.hasNext()) { - Header header = iterator.next(); - final String headerName = header.getName(); - if (headerName != null) { - boolean match = Arrays.stream(names) - .anyMatch(headerName::equalsIgnoreCase); - if (!match) { - results.add(header); - } - } - } - } - return results; - } } diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java index e554b51..6a409fa 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/fetch/MailboxMessageResultUtilsTest.java @@ -29,9 +29,11 @@ import org.apache.james.mailbox.model.Header; import org.junit.Before; import org.junit.Test; +import com.google.common.collect.ImmutableList; + public class MailboxMessageResultUtilsTest { - private static final String[] NAMES = { "One", "Three" }; + private static final ImmutableList<String> NAMES = ImmutableList.of("One", "Three"); Header headerOne; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org