diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index c9f5c15a3..86baa13fd 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -1,9 +1,10 @@ package com.fsck.k9.activity.setup; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; -import java.util.Vector; +import java.util.List; import android.content.Context; import android.content.Intent; @@ -134,8 +135,8 @@ public class Prefs extends K9PreferenceActivity { addPreferencesFromResource(R.xml.global_preferences); mLanguage = (ListPreference) findPreference(PREFERENCE_LANGUAGE); - Vector entryVector = new Vector(Arrays.asList(mLanguage.getEntries())); - Vector entryValueVector = new Vector(Arrays.asList(mLanguage.getEntryValues())); + List entryVector = new ArrayList(Arrays.asList(mLanguage.getEntries())); + List entryValueVector = new ArrayList(Arrays.asList(mLanguage.getEntryValues())); String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages); HashSet supportedLanguageSet = new HashSet(Arrays.asList(supportedLanguages)); for (int i = entryVector.size() - 1; i > -1; --i) { diff --git a/src/com/fsck/k9/crypto/Apg.java b/src/com/fsck/k9/crypto/Apg.java index 0b85ff039..c7417878d 100644 --- a/src/com/fsck/k9/crypto/Apg.java +++ b/src/com/fsck/k9/crypto/Apg.java @@ -1,6 +1,7 @@ package com.fsck.k9.crypto; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -149,7 +150,7 @@ public class Apg extends CryptoProvider { intent.putExtra(EXTRA_INTENT_VERSION, INTENT_VERSION); long[] initialKeyIds = null; if (!pgpData.hasEncryptionKeys()) { - Vector keyIds = new Vector(); + List keyIds = new ArrayList(); if (pgpData.hasSignatureKey()) { keyIds.add(pgpData.getSignatureKeyId()); } diff --git a/src/com/fsck/k9/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java index d06cf52c8..57bbdc911 100644 --- a/src/com/fsck/k9/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -422,13 +422,13 @@ public class MimeMessage extends Message { } class MimeMessageBuilder implements ContentHandler { - private Stack stack = new Stack(); + private final Deque stack = new ArrayDeque(); public MimeMessageBuilder() { } private void expect(Class c) { - if (!c.isInstance(stack.peek())) { + if (!c.isInstance(stack.peekFirst())) { throw new IllegalStateException("Internal stack error: " + "Expected '" + c.getName() + "' found '" + stack.peek().getClass().getName() + "'"); } @@ -436,13 +436,13 @@ public class MimeMessage extends Message { public void startMessage() { if (stack.isEmpty()) { - stack.push(MimeMessage.this); + stack.addFirst(MimeMessage.this); } else { expect(Part.class); try { MimeMessage m = new MimeMessage(); - ((Part)stack.peek()).setBody(m); - stack.push(m); + ((Part)stack.peekFirst()).setBody(m); + stack.addFirst(m); } catch (MessagingException me) { throw new Error(me); } @@ -451,7 +451,7 @@ public class MimeMessage extends Message { public void endMessage() { expect(MimeMessage.class); - stack.pop(); + stack.removeFirst(); } public void startHeader() { @@ -462,7 +462,7 @@ public class MimeMessage extends Message { expect(Part.class); try { Field parsedField = DefaultFieldParser.parse(field.getRaw(), null); - ((Part)stack.peek()).addHeader(parsedField.getName(), parsedField.getBody().trim()); + ((Part)stack.peekFirst()).addHeader(parsedField.getName(), parsedField.getBody().trim()); } catch (MessagingException me) { throw new Error(me); } catch (MimeException me) { @@ -474,7 +474,7 @@ public class MimeMessage extends Message { expect(Part.class); try { String[] tokens = fieldData.split(":", 2); - ((Part)stack.peek()).addHeader(tokens[0], tokens[1].trim()); + ((Part)stack.peekFirst()).addHeader(tokens[0], tokens[1].trim()); } catch (MessagingException me) { throw new Error(me); } @@ -487,11 +487,11 @@ public class MimeMessage extends Message { public void startMultipart(BodyDescriptor bd) { expect(Part.class); - Part e = (Part)stack.peek(); + Part e = (Part)stack.peekFirst(); try { MimeMultipart multiPart = new MimeMultipart(e.getContentType()); e.setBody(multiPart); - stack.push(multiPart); + stack.addFirst(multiPart); } catch (MessagingException me) { throw new Error(me); } @@ -501,14 +501,14 @@ public class MimeMessage extends Message { expect(Part.class); Body body = MimeUtility.decodeBody(in, bd.getTransferEncoding()); try { - ((Part)stack.peek()).setBody(body); + ((Part)stack.peekFirst()).setBody(body); } catch (MessagingException me) { throw new Error(me); } } public void endMultipart() { - stack.pop(); + stack.removeFirst(); } public void startBodyPart() { @@ -516,8 +516,8 @@ public class MimeMessage extends Message { try { MimeBodyPart bodyPart = new MimeBodyPart(); - ((MimeMultipart)stack.peek()).addBodyPart(bodyPart); - stack.push(bodyPart); + ((MimeMultipart)stack.peekFirst()).addBodyPart(bodyPart); + stack.addFirst(bodyPart); } catch (MessagingException me) { throw new Error(me); } @@ -525,7 +525,7 @@ public class MimeMessage extends Message { public void endBodyPart() { expect(BodyPart.class); - stack.pop(); + stack.removeFirst(); } public void epilogue(InputStream is) throws IOException { @@ -535,7 +535,7 @@ public class MimeMessage extends Message { while ((b = is.read()) != -1) { sb.append((char)b); } - // ((Multipart) stack.peek()).setEpilogue(sb.toString()); + // ((Multipart) stack.peekFirst()).setEpilogue(sb.toString()); } public void preamble(InputStream is) throws IOException { @@ -545,7 +545,7 @@ public class MimeMessage extends Message { while ((b = is.read()) != -1) { sb.append((char)b); } - ((MimeMultipart)stack.peek()).setPreamble(sb.toString()); + ((MimeMultipart)stack.peekFirst()).setPreamble(sb.toString()); } diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index f767997fb..b16ab18ac 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -45,14 +45,15 @@ import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Date; +import java.util.Deque; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Stack; import java.util.zip.GZIPInputStream; /** @@ -1949,7 +1950,7 @@ public class WebDavStore extends Store { */ public class WebDavHandler extends DefaultHandler { private DataSet mDataSet = new DataSet(); - private Stack mOpenTags = new Stack(); + private final Deque mOpenTags = new ArrayDeque(); public DataSet getDataSet() { return this.mDataSet; @@ -1968,12 +1969,12 @@ public class WebDavStore extends Store { @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - mOpenTags.push(localName); + mOpenTags.addFirst(localName); } @Override public void endElement(String namespaceURI, String localName, String qName) { - mOpenTags.pop(); + mOpenTags.removeFirst(); /** Reset the hash temp variables */ if (localName.equals("response")) { @@ -1984,7 +1985,7 @@ public class WebDavStore extends Store { @Override public void characters(char ch[], int start, int length) { String value = new String(ch, start, length); - mDataSet.addValue(value, mOpenTags.peek()); + mDataSet.addValue(value, mOpenTags.peekFirst()); } }