Archiviert
13
0

Don't throw an exception the first time we initialize IntHashMap.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2013-08-29 23:57:20 +02:00
Ursprung fc01a61290
Commit 8295b951d9

Datei anzeigen

@ -98,9 +98,25 @@ public class WrappedIntHashMap {
* @return The object that was removed, or NULL if the key is not present.
*/
public Object remove(int key) {
initializeGetMethod();
if (REMOVE_METHOD == null)
return removeFallback(key);
return invokeMethod(REMOVE_METHOD, key);
}
/**
* Remove a entry in the IntHashMap using a fallback method.
* @param key - the key of the mapping to remove.
* @return The removed element.
*/
private Object removeFallback(int key) {
Object old = get(key);
invokeMethod(PUT_METHOD, key, null);
return old;
}
/**
* Invoke a particular method on the current handle
* @param method - the current method.
@ -162,6 +178,8 @@ public class WrappedIntHashMap {
// Suppress
}
}
if (GET_METHOD == null)
throw new IllegalStateException("Unable to find appropriate GET_METHOD for IntHashMap.");
}
}