use of org.eclipse.collections.api.block.function.primitive.LongFunction0 in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method getIfAbsentPut_Function.
@Test
public void getIfAbsentPut_Function() {
LongFunction0 factory = () -> 100L;
LongFunction0 factoryThrows = () -> {
throw new AssertionError();
};
MutableLongLongMap map1 = this.getEmptyMap();
Assert.assertEquals(100L, map1.getIfAbsentPut(0L, factory));
Assert.assertEquals(100L, map1.getIfAbsentPut(0L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 100L), map1);
Assert.assertEquals(100L, map1.getIfAbsentPut(1L, factory));
Assert.assertEquals(100L, map1.getIfAbsentPut(1L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 100L, 1L, 100L), map1);
MutableLongLongMap map2 = this.getEmptyMap();
Assert.assertEquals(100L, map2.getIfAbsentPut(1L, factory));
Assert.assertEquals(100L, map2.getIfAbsentPut(1L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(1L, 100L), map2);
Assert.assertEquals(100L, map2.getIfAbsentPut(0L, factory));
Assert.assertEquals(100L, map2.getIfAbsentPut(0L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 100L, 1L, 100L), map2);
MutableLongLongMap map3 = this.getEmptyMap();
Assert.assertEquals(100L, map3.getIfAbsentPut(32L, factory));
Assert.assertEquals(100L, map3.getIfAbsentPut(32L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(32L, 100L), map3);
MutableLongLongMap map4 = this.getEmptyMap();
Assert.assertEquals(100L, map4.getIfAbsentPut(33L, factory));
Assert.assertEquals(100L, map4.getIfAbsentPut(33L, factoryThrows));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(33L, 100L), map4);
}
Aggregations