1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Merge pull request #87 from andrewgaul/map-initialization

Optimize static map, remove unneeded inner class, and use unmodifiable map.
This commit is contained in:
Andrew Chen 2011-11-03 06:31:32 -07:00
commit 64e2247e8f

View File

@ -1982,21 +1982,22 @@ public class WebDavStore extends Store {
/** /**
* Holds the mappings from the name returned from Exchange to the MIME format header name * Holds the mappings from the name returned from Exchange to the MIME format header name
*/ */
private final HashMap<String, String> mHeaderMappings = new HashMap<String, String>() { private static final Map<String, String> HEADER_MAPPINGS;
{ static {
put("mime-version", "MIME-Version"); Map<String, String> map = new HashMap<String, String>();
put("content-type", "Content-Type"); map.put("mime-version", "MIME-Version");
put("subject", "Subject"); map.put("content-type", "Content-Type");
put("date", "Date"); map.put("subject", "Subject");
put("thread-topic", "Thread-Topic"); map.put("date", "Date");
put("thread-index", "Thread-Index"); map.put("thread-topic", "Thread-Topic");
put("from", "From"); map.put("thread-index", "Thread-Index");
put("to", "To"); map.put("from", "From");
put("in-reply-to", "In-Reply-To"); map.put("to", "To");
put("cc", "Cc"); map.put("in-reply-to", "In-Reply-To");
put("getcontentlength", "Content-Length"); map.put("cc", "Cc");
} map.put("getcontentlength", "Content-Length");
}; HEADER_MAPPINGS = Collections.unmodifiableMap(map);
}
private boolean mReadStatus = false; private boolean mReadStatus = false;
private String mUid = ""; private String mUid = "";
@ -2004,11 +2005,11 @@ public class WebDavStore extends Store {
private ArrayList<String> mHeaders = new ArrayList<String>(); private ArrayList<String> mHeaders = new ArrayList<String>();
public void addHeader(String field, String value) { public void addHeader(String field, String value) {
String headerName = mHeaderMappings.get(field); String headerName = HEADER_MAPPINGS.get(field);
if (headerName != null) { if (headerName != null) {
this.mMessageHeaders.put(mHeaderMappings.get(field), value); this.mMessageHeaders.put(HEADER_MAPPINGS.get(field), value);
this.mHeaders.add(mHeaderMappings.get(field)); this.mHeaders.add(HEADER_MAPPINGS.get(field));
} }
} }