Don't throw an exception the first time we initialize IntHashMap.
Dieser Commit ist enthalten in:
Ursprung
fc01a61290
Commit
8295b951d9
@ -98,9 +98,25 @@ public class WrappedIntHashMap {
|
|||||||
* @return The object that was removed, or NULL if the key is not present.
|
* @return The object that was removed, or NULL if the key is not present.
|
||||||
*/
|
*/
|
||||||
public Object remove(int key) {
|
public Object remove(int key) {
|
||||||
|
initializeGetMethod();
|
||||||
|
|
||||||
|
if (REMOVE_METHOD == null)
|
||||||
|
return removeFallback(key);
|
||||||
return invokeMethod(REMOVE_METHOD, 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
|
* Invoke a particular method on the current handle
|
||||||
* @param method - the current method.
|
* @param method - the current method.
|
||||||
@ -162,7 +178,9 @@ public class WrappedIntHashMap {
|
|||||||
// Suppress
|
// Suppress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Unable to find appropriate GET_METHOD for IntHashMap.");
|
|
||||||
|
if (GET_METHOD == null)
|
||||||
|
throw new IllegalStateException("Unable to find appropriate GET_METHOD for IntHashMap.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren