@Test public void computeIfAbsentUsingImplementation() { final Int2IntHashMap int2IntHashMap = new Int2IntHashMap(-1); final int key = 0; final int result = int2IntHashMap.computeIfAbsent(key, (k) -> k); assertEquals(key, result); }
@Test public void shouldComputeIfAbsent() { final int testKey = 7; final int testValue = 7; assertEquals(map.missingValue(), map.get(testKey)); assertThat(map.computeIfAbsent(testKey, (i) -> testValue), is(testValue)); assertThat(map.get(testKey), is(testValue)); }