@Test public void deleteElementOnComputeFunctionReturningNull() { LocalMap<String, String> map = sharedData.getLocalMap("foo"); // put an initial value map.put("hello", "world"); // retuning null we should remove the entry map.computeIfPresent("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); // Same for LocalMap#compute and LocalMap#compute map.compute("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); // put a value one more time map.put("hello", "world"); map.merge("hello", "world!!!!!!", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); map.computeIfAbsent("hello", key -> null); assertFalse(map.containsKey("hello")); }
map.putAll(another); assertTrue(map.containsKey("new")); assertTrue(map.containsValue("value"));
@Test public void deleteElementOnComputeFunctionReturningNull() { LocalMap<String, String> map = sharedData.getLocalMap("foo"); // put an initial value map.put("hello", "world"); // retuning null we should remove the entry map.computeIfPresent("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); // Same for LocalMap#compute and LocalMap#compute map.compute("hello", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); // put a value one more time map.put("hello", "world"); map.merge("hello", "world!!!!!!", (key, oldValue) -> null); assertFalse(map.containsKey("hello")); map.computeIfAbsent("hello", key -> null); assertFalse(map.containsKey("hello")); }
/** * Returns <code>true</code> if this map contains a mapping for the specified * key. * @param key key whose presence in this map is to be tested * @return <code>true</code> if this map contains a mapping for the specified key */ public boolean containsKey(Object key) { boolean ret = delegate.containsKey(key); return ret; }
/** * Returns <code>true</code> if this map contains a mapping for the specified * key. * @param key key whose presence in this map is to be tested * @return <code>true</code> if this map contains a mapping for the specified key */ public boolean containsKey(Object key) { boolean ret = delegate.containsKey(key); return ret; }
public static boolean containsKey(io.vertx.core.shareddata.LocalMap<Object, Object> j_receiver, java.lang.Object key) { return j_receiver.containsKey(io.vertx.core.impl.ConversionHelper.toObject(key)); } public static boolean containsValue(io.vertx.core.shareddata.LocalMap<Object, Object> j_receiver, java.lang.Object value) {
map.putAll(another); assertTrue(map.containsKey("new")); assertTrue(map.containsValue("value"));