assertEquals(map.keySet().size(), 0); assertEquals(map.getOrDefault("foo", "miss"), "miss"); assertNull(map.putIfAbsent("foo", "there")); assertNotNull(map.putIfAbsent("foo", "there")); assertEquals(map.getOrDefault("foo", "miss"), "there"); assertEquals(map.get("foo"), "there"); assertNull(map.get("missing"));
/** * Returns the value to which the specified key is mapped, or * <code>defaultValue</code> if this map contains no mapping for the key. * @param key the key whose associated value is to be returned * @param defaultValue the default mapping of the key * @return the value to which the specified key is mapped, or <code>defaultValue</code> if this map contains no mapping for the key */ public V getOrDefault(Object key, V defaultValue) { V ret = (V)__typeArg_1.wrap(delegate.getOrDefault(key, __typeArg_1.<V>unwrap(defaultValue))); return ret; }
/** * Returns the value to which the specified key is mapped, or * <code>defaultValue</code> if this map contains no mapping for the key. * @param key the key whose associated value is to be returned * @param defaultValue the default mapping of the key * @return the value to which the specified key is mapped, or <code>defaultValue</code> if this map contains no mapping for the key */ public V getOrDefault(Object key, V defaultValue) { V ret = (V)__typeArg_1.wrap(delegate.getOrDefault(key, __typeArg_1.<V>unwrap(defaultValue))); return ret; }
assertEquals(map.keySet().size(), 0); assertEquals(map.getOrDefault("foo", "miss"), "miss"); assertNull(map.putIfAbsent("foo", "there")); assertNotNull(map.putIfAbsent("foo", "there")); assertEquals(map.getOrDefault("foo", "miss"), "there"); assertEquals(map.get("foo"), "there"); assertNull(map.get("missing"));
public static java.lang.Object getOrDefault(io.vertx.core.shareddata.LocalMap<Object, Object> j_receiver, java.lang.Object key, java.lang.Object defaultValue) { return io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.getOrDefault(io.vertx.core.impl.ConversionHelper.toObject(key), io.vertx.core.impl.ConversionHelper.toObject(defaultValue))); } }