mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
String caches its hash code, so prefer HashMap to TreeMap.
This commit is contained in:
@@ -11,7 +11,6 @@ import java.util.Enumeration;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ public class FontManagerImpl implements FontManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Map from languages to fonts
|
// Map from languages to fonts
|
||||||
private final Map<String, Font> fonts = new TreeMap<String, Font>();
|
private final Map<String, Font> fonts = new HashMap<String, Font>();
|
||||||
|
|
||||||
private volatile Font defaultFont = null, uiFont = null;
|
private volatile Font defaultFont = null, uiFont = null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.sf.briar.lifecycle;
|
package net.sf.briar.lifecycle;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -38,7 +38,7 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
|||||||
|
|
||||||
WindowsShutdownManagerImpl() {
|
WindowsShutdownManagerImpl() {
|
||||||
// Use the Unicode versions of Win32 API calls
|
// Use the Unicode versions of Win32 API calls
|
||||||
options = new TreeMap<String, Object>();
|
options = new HashMap<String, Object>();
|
||||||
options.put(Library.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
|
options.put(Library.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
|
||||||
options.put(Library.OPTION_FUNCTION_MAPPER,
|
options.put(Library.OPTION_FUNCTION_MAPPER,
|
||||||
W32APIFunctionMapper.UNICODE);
|
W32APIFunctionMapper.UNICODE);
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
@@ -46,14 +47,14 @@ public class ZipUtilsTest extends TestCase {
|
|||||||
zip.flush();
|
zip.flush();
|
||||||
zip.close();
|
zip.close();
|
||||||
|
|
||||||
Map<String, String> expected = new TreeMap<String, String>();
|
Map<String, String> expected = Collections.singletonMap("abc/def",
|
||||||
expected.put("abc/def", "foo bar baz");
|
"foo bar baz");
|
||||||
checkZipEntries(dest, expected);
|
checkZipEntries(dest, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkZipEntries(File f, Map<String, String> expected)
|
private void checkZipEntries(File f, Map<String, String> expected)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Map<String, String> found = new TreeMap<String, String>();
|
Map<String, String> found = new HashMap<String, String>();
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
assertTrue(f.isFile());
|
assertTrue(f.isFile());
|
||||||
ZipInputStream unzip = new ZipInputStream(new FileInputStream(f));
|
ZipInputStream unzip = new ZipInputStream(new FileInputStream(f));
|
||||||
@@ -108,7 +109,7 @@ public class ZipUtilsTest extends TestCase {
|
|||||||
zip.flush();
|
zip.flush();
|
||||||
zip.close();
|
zip.close();
|
||||||
|
|
||||||
Map<String, String> expected = new TreeMap<String, String>();
|
Map<String, String> expected = new HashMap<String, String>();
|
||||||
expected.put("ghi/def/1", "one one one");
|
expected.put("ghi/def/1", "one one one");
|
||||||
expected.put("ghi/def/2", "two two two");
|
expected.put("ghi/def/2", "two two two");
|
||||||
expected.put("ghi/3", "three three three");
|
expected.put("ghi/3", "three three three");
|
||||||
|
|||||||
Reference in New Issue
Block a user