use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method contains.
@Override
@Test
public void contains() {
super.contains();
MutableLongLongMap map1 = this.classUnderTest();
map1.put(35L, 35L);
Assert.assertTrue(map1.contains(35L));
map1.removeKey(0L);
Assert.assertFalse(map1.contains(0L));
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method containsKey.
@Override
@Test
public void containsKey() {
super.containsKey();
MutableLongLongMap map1 = this.classUnderTest();
map1.removeKey(0L);
Assert.assertFalse(map1.containsKey(0L));
Assert.assertEquals(0L, map1.get(0L));
map1.removeKey(0L);
Assert.assertFalse(map1.containsKey(0L));
Assert.assertEquals(0L, map1.get(0L));
map1.removeKey(1L);
Assert.assertFalse(map1.containsKey(1L));
Assert.assertEquals(0L, map1.get(1L));
map1.removeKey(31L);
Assert.assertFalse(map1.containsKey(31L));
Assert.assertEquals(0L, map1.get(31L));
map1.removeKey(32L);
Assert.assertFalse(map1.containsKey(32L));
Assert.assertEquals(0L, map1.get(32L));
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method get.
@Override
@Test
public void get() {
super.get();
MutableLongLongMap map1 = this.classUnderTest();
map1.put(0L, 1L);
Assert.assertEquals(1L, map1.get(0L));
map1.put(0L, 0L);
Assert.assertEquals(0L, map1.get(0L));
map1.put(5L, 5L);
Assert.assertEquals(5L, map1.get(5L));
map1.put(35L, 35L);
Assert.assertEquals(35L, map1.get(35L));
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method freeze.
@Test
public void freeze() {
MutableLongLongMap mutableLongLongMap = this.classUnderTest();
LongSet frozenSet = mutableLongLongMap.keySet().freeze();
LongSet frozenSetCopy = LongHashSet.newSetWith(mutableLongLongMap.keySet().toArray());
Assert.assertEquals(frozenSet, frozenSetCopy);
Assert.assertEquals(frozenSetCopy, mutableLongLongMap.keySet().freeze());
for (int i = 0; i < 32; i++) {
mutableLongLongMap.put((long) i, (long) i);
Assert.assertEquals(frozenSet, frozenSetCopy);
}
LongSet frozenSetForRemove = mutableLongLongMap.keySet().freeze();
LongSet frozenSetCopyForRemove = LongHashSet.newSetWith(mutableLongLongMap.keySet().toArray());
Assert.assertEquals(frozenSetForRemove, frozenSetCopyForRemove);
Assert.assertEquals(frozenSetCopyForRemove, mutableLongLongMap.keySet().freeze());
for (int i = 0; i < 32; i++) {
mutableLongLongMap.remove((long) i);
Assert.assertEquals(frozenSetForRemove, frozenSetCopyForRemove);
}
MutableLongLongMap mutableLongLongMapForClear = this.classUnderTest();
LongSet frozenSetForClear = mutableLongLongMapForClear.keySet().freeze();
LongSet frozenSetCopyForClear = LongHashSet.newSetWith(mutableLongLongMapForClear.keySet().toArray());
mutableLongLongMapForClear.clear();
Assert.assertEquals(frozenSetForClear, frozenSetCopyForClear);
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method getIfAbsentPut.
@Test
public void getIfAbsentPut() {
MutableLongLongMap map1 = this.getEmptyMap();
Assert.assertEquals(50L, map1.getIfAbsentPut(0L, 50L));
Assert.assertEquals(50L, map1.getIfAbsentPut(0L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 50L), map1);
Assert.assertEquals(50L, map1.getIfAbsentPut(1L, 50L));
Assert.assertEquals(50L, map1.getIfAbsentPut(1L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 50L, 1L, 50L), map1);
MutableLongLongMap map2 = this.getEmptyMap();
Assert.assertEquals(50L, map2.getIfAbsentPut(1L, 50L));
Assert.assertEquals(50L, map2.getIfAbsentPut(1L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(1L, 50L), map2);
Assert.assertEquals(50L, map2.getIfAbsentPut(0L, 50L));
Assert.assertEquals(50L, map2.getIfAbsentPut(0L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 50L, 1L, 50L), map2);
MutableLongLongMap map3 = this.getEmptyMap();
Assert.assertEquals(50L, map3.getIfAbsentPut(32L, 50L));
Assert.assertEquals(50L, map3.getIfAbsentPut(32L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(32L, 50L), map3);
MutableLongLongMap map4 = this.getEmptyMap();
Assert.assertEquals(50L, map4.getIfAbsentPut(33L, 50L));
Assert.assertEquals(50L, map4.getIfAbsentPut(33L, 100L));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(33L, 50L), map4);
}
Aggregations