/** * Invoked when a value must be inserted into the underlying map, regardless of preconditions. * @param key - the key. * @param value - the value to insert. */ private void putInternal(int key, Object value) { invokeMethod(PUT_METHOD, key, value); }
/** * Retrieve the value associated with a specific key, or NULL if not found. * @param key - the integer key. * @return The associated value, or NULL. */ public Object get(int key) { initializeGetMethod(); return invokeMethod(GET_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; }
/** * Remove a mapping of a key to a value if it is present. * @param key - the key of the mapping to remove. * @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); }