1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 09:52:16 -05:00

Merge branch 'legacy-collections' of https://github.com/andrewgaul/k-9 into andrewgaul

* 'legacy-collections' of https://github.com/andrewgaul/k-9:
  Prefer unsynchronized Collection types
This commit is contained in:
Andrew Chen 2011-11-01 13:26:54 -07:00
commit ea05f3b5d0
4 changed files with 30 additions and 27 deletions

View File

@ -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<CharSequence> entryVector = new Vector<CharSequence>(Arrays.asList(mLanguage.getEntries()));
Vector<CharSequence> entryValueVector = new Vector<CharSequence>(Arrays.asList(mLanguage.getEntryValues()));
List<CharSequence> entryVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntries()));
List<CharSequence> entryValueVector = new ArrayList<CharSequence>(Arrays.asList(mLanguage.getEntryValues()));
String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages);
HashSet<String> supportedLanguageSet = new HashSet<String>(Arrays.asList(supportedLanguages));
for (int i = entryVector.size() - 1; i > -1; --i) {

View File

@ -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<Long> keyIds = new Vector<Long>();
List<Long> keyIds = new ArrayList<Long>();
if (pgpData.hasSignatureKey()) {
keyIds.add(pgpData.getSignatureKeyId());
}

View File

@ -422,13 +422,13 @@ public class MimeMessage extends Message {
}
class MimeMessageBuilder implements ContentHandler {
private Stack<Object> stack = new Stack<Object>();
private final Deque<Object> stack = new ArrayDeque<Object>();
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());
}

View File

@ -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<String> mOpenTags = new Stack<String>();
private final Deque<String> mOpenTags = new ArrayDeque<String>();
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());
}
}