summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-09 05:39:51 +0200
committerSven Gothel <[email protected]>2013-06-09 05:39:51 +0200
commit83cc11676314488ca0669366933e807e8fdead87 (patch)
tree6178c036dc513ccc420a0e53e03a09857686b57c /src
parentb98825eb7cfb61aead4a7dff57471cd2d2c26823 (diff)
Bug 747: AndroidVersion: HashMap -> IntObjectHashMap
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/common/os/AndroidVersion.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java
index cb6c3e5..d2afbbc 100644
--- a/src/java/com/jogamp/common/os/AndroidVersion.java
+++ b/src/java/com/jogamp/common/os/AndroidVersion.java
@@ -28,9 +28,8 @@
package com.jogamp.common.os;
import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
+import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.common.util.ReflectionUtil;
public class AndroidVersion {
@@ -72,8 +71,8 @@ public class AndroidVersion {
INCREMENTAL = getString(abvClass, abvObject, "INCREMENTAL");
RELEASE = getString(abvClass, abvObject, "RELEASE");
SDK_INT = getInt(abvClass, abvObject, "SDK_INT");
- final Map<Integer, String> version_codes = getVersionCodes(abvcClass, abvcObject);
- String sdk_name = version_codes.get(new Integer(SDK_INT));
+ final IntObjectHashMap version_codes = getVersionCodes(abvcClass, abvcObject);
+ final String sdk_name = (String) version_codes.get(SDK_INT);
SDK_NAME = ( null != sdk_name ) ? sdk_name : "SDK_"+SDK_INT ;
} else {
CODENAME = null;
@@ -84,9 +83,9 @@ public class AndroidVersion {
}
}
- private static final Map<Integer, String> getVersionCodes(Class<?> cls, Object obj) {
- HashMap<Integer, String> map = new HashMap<Integer, String>();
- Field[] fields = cls.getFields();
+ private static final IntObjectHashMap getVersionCodes(Class<?> cls, Object obj) {
+ final Field[] fields = cls.getFields();
+ IntObjectHashMap map = new IntObjectHashMap( 3 * fields.length / 2, 0.75f );
for(int i=0; i<fields.length; i++) {
try {
final int version = fields[i].getInt(obj);