use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class LongLongHashMapValuesTest method clear.
@Override
@Test
public void clear() {
MutableLongCollection emptyCollection = this.newWith();
emptyCollection.clear();
Verify.assertSize(0, emptyCollection);
MutableLongLongMap map = newWithKeysValues(1L, 1L, 2L, 2L, 3L, 3L);
MutableLongCollection collection = map.values();
collection.clear();
Verify.assertEmpty(collection);
Verify.assertEmpty(map);
Verify.assertSize(0, collection);
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertFalse(collection.contains(3L));
MutableLongCollection collection1 = this.newWith(0L, 1L, 31L, 32L);
collection1.clear();
Verify.assertEmpty(collection1);
Verify.assertSize(0, collection1);
Assert.assertFalse(collection1.contains(0L));
Assert.assertFalse(collection1.contains(1L));
Assert.assertFalse(collection1.contains(31L));
Assert.assertFalse(collection1.contains(32L));
MutableLongCollection collection2 = this.newWith(0L, 1L, 2L);
collection2.clear();
Verify.assertSize(0, collection2);
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class LongLongHashMapValuesTest method removeAll.
@Override
@Test
public void removeAll() {
Assert.assertFalse(this.newWith().removeAll());
Assert.assertFalse(this.newWith().removeAll(1L));
MutableLongLongMap map = newWithKeysValues(1L, 1L, 2L, 2L, 3L, 3L);
MutableLongCollection collection = map.values();
Assert.assertFalse(collection.removeAll());
Assert.assertTrue(collection.removeAll(1L, 5L));
Assert.assertFalse(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(map.contains(1L));
Assert.assertTrue(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertTrue(collection.removeAll(3L, 2L));
Assert.assertTrue(collection.isEmpty());
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertFalse(collection.contains(3L));
Assert.assertFalse(map.contains(1L));
Assert.assertFalse(map.contains(2L));
Assert.assertFalse(map.contains(3L));
Assert.assertTrue(map.isEmpty());
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class LongLongHashMapValuesTest method retainAll_iterable.
@Override
@Test
public void retainAll_iterable() {
Assert.assertFalse(this.newWith().retainAll(new LongArrayList()));
Assert.assertFalse(this.newWith().retainAll(LongArrayList.newListWith(1L)));
MutableLongLongMap map = newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
MutableLongCollection collection = map.values();
Assert.assertFalse(collection.retainAll(LongArrayList.newListWith(0L, 1L, 2L, 3L)));
Assert.assertTrue(collection.retainAll(LongArrayList.newListWith(0L, 2L, 3L, 5L)));
Assert.assertTrue(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertTrue(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertTrue(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(LongArrayList.newListWith(2L, 3L, 5L)));
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertTrue(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(LongArrayList.newListWith(3L, 5L)));
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertFalse(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(LongArrayList.newListWith(0L, 0L, 1L)));
Assert.assertTrue(collection.isEmpty());
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertFalse(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertFalse(map.contains(2L));
Assert.assertFalse(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(map.isEmpty());
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method getIfAbsentPutWith.
@Test
public void getIfAbsentPutWith() {
LongFunction<String> functionLength = (String string) -> (long) string.length();
LongFunction<String> functionThrows = (String string) -> {
throw new AssertionError();
};
MutableLongLongMap map1 = this.getEmptyMap();
Assert.assertEquals(9L, map1.getIfAbsentPutWith(0L, functionLength, "123456789"));
Assert.assertEquals(9L, map1.getIfAbsentPutWith(0L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 9L), map1);
Assert.assertEquals(9L, map1.getIfAbsentPutWith(1L, functionLength, "123456789"));
Assert.assertEquals(9L, map1.getIfAbsentPutWith(1L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 9L, 1L, 9L), map1);
MutableLongLongMap map2 = this.getEmptyMap();
Assert.assertEquals(9L, map2.getIfAbsentPutWith(1L, functionLength, "123456789"));
Assert.assertEquals(9L, map2.getIfAbsentPutWith(1L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(1L, 9L), map2);
Assert.assertEquals(9L, map2.getIfAbsentPutWith(0L, functionLength, "123456789"));
Assert.assertEquals(9L, map2.getIfAbsentPutWith(0L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 9L, 1L, 9L), map2);
MutableLongLongMap map3 = this.getEmptyMap();
Assert.assertEquals(9L, map3.getIfAbsentPutWith(32L, functionLength, "123456789"));
Assert.assertEquals(9L, map3.getIfAbsentPutWith(32L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(32L, 9L), map3);
MutableLongLongMap map4 = this.getEmptyMap();
Assert.assertEquals(9L, map4.getIfAbsentPutWith(33L, functionLength, "123456789"));
Assert.assertEquals(9L, map4.getIfAbsentPutWith(33L, functionThrows, "unused"));
Assert.assertEquals(LongLongHashMap.newWithKeysValues(33L, 9L), map4);
}
use of org.eclipse.collections.api.map.primitive.MutableLongLongMap in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method withoutKey.
@Test
public void withoutKey() {
MutableLongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 31L, 31L, 32L, 32L);
MutableLongLongMap mapWithout = map.withoutKey(32L);
Assert.assertSame(map, mapWithout);
Assert.assertEquals(LongLongHashMap.newWithKeysValues(0L, 0L, 1L, 1L, 31L, 31L), mapWithout);
}
Aggregations