/** * Overloaded version of {@link Map#get(Object)} that takes a primitive int key. * * @param key for indexing the {@link Map} * @return the value if found otherwise null */ public V get(final int key) { return unmapNullValue(getMapped(key)); }
/** * Get a value for a given key, or if it does not exist then default the value via a * {@link java.util.function.IntFunction} and put it in the map. * <p> * Primitive specialized version of {@link java.util.Map#computeIfAbsent}. * * @param key to search on. * @param mappingFunction to provide a value if the get returns null. * @return the value if found otherwise the default. */ public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) { V value = getMapped(key); if (value == null) { value = mappingFunction.apply(key); if (value != null) { put(key, value); } } else { value = unmapNullValue(value); } return value; }
/** * Overloaded version of {@link Map#get(Object)} that takes a primitive int key. * * @param key for indexing the {@link Map} * @return the value if found otherwise null */ public V get(final int key) { return unmapNullValue(getMapped(key)); }
/** * Get a value for a given key, or if it does not exist then default the value via a * {@link java.util.function.IntFunction} and put it in the map. * <p> * Primitive specialized version of {@link java.util.Map#computeIfAbsent}. * * @param key to search on. * @param mappingFunction to provide a value if the get returns null. * @return the value if found otherwise the default. */ public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) { V value = getMapped(key); if (value == null) { value = mappingFunction.apply(key); if (value != null) { put(key, value); } } else { value = unmapNullValue(value); } return value; }