mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Initialize static map optimally
Remove unneeded inner class, use unmodifiable map, and mark as static.
This commit is contained in:
parent
976761e0e5
commit
70b635ec30
@ -1990,21 +1990,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 = "";
|
||||||
@ -2012,11 +2013,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user