diff --git a/src/com/fsck/k9/mail/internet/MimeHeader.java b/src/com/fsck/k9/mail/internet/MimeHeader.java index 6a2672a93..1b260cf9f 100644 --- a/src/com/fsck/k9/mail/internet/MimeHeader.java +++ b/src/com/fsck/k9/mail/internet/MimeHeader.java @@ -83,7 +83,14 @@ public class MimeHeader public String[] getHeader(String name) { - ArrayList values = findHeaders(name); + ArrayList values = new ArrayList(); + for (Field field : mFields) + { + if (field.name.equalsIgnoreCase(name)) + { + values.add(field.value); + } + } if (values.size() == 0) { return null; @@ -93,27 +100,17 @@ public class MimeHeader public void removeHeader(String name) { - - ArrayList removeFields = findHeaders(name); + ArrayList removeFields = new ArrayList(); + for (Field field : mFields) + { + if (field.name.equalsIgnoreCase(name)) + { + removeFields.add(field); + } + } mFields.removeAll(removeFields); } - private ArrayList findHeaders(String name) { - ArrayList values = new ArrayList(); - Iterator iter = mFields.iterator(); - while (iter.hasNext()) - { - Field field = iter.next(); - if (field.name.equalsIgnoreCase(name) ) - { - values.add(field.value); - } - } - - return values; - } - - public void writeTo(OutputStream out) throws IOException, MessagingException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);