use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method toArray.
@Test
public void toArray() {
LongLongMap map = this.newWithKeysValues(1L, 1L, 2L, 2L);
long[] array = map.toArray();
Assert.assertTrue(Arrays.equals(new long[] { 1L, 2L }, array) || Arrays.equals(new long[] { 2L, 1L }, array));
Assert.assertEquals(0, this.getEmptyMap().toArray().length);
Assert.assertTrue(Arrays.equals(new long[] { 1L }, this.newWithKeysValues(1L, 1L).toArray()));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method max.
@Test
public void max() {
LongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
Assert.assertEquals(3L, map.max());
Assert.assertEquals(3L, this.newWithKeysValues(3L, 3L).max());
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method maxIfEmpty.
@Test
public void maxIfEmpty() {
Assert.assertEquals(5L, this.getEmptyMap().maxIfEmpty(5L));
Assert.assertEquals(0L, this.getEmptyMap().maxIfEmpty(0L));
LongLongMap map = this.newWithKeysValues(1L, 1L, 0L, 0L, 9L, 9L, 7L, 7L);
Assert.assertEquals(9L, map.maxIfEmpty(5L));
Assert.assertEquals(3L, this.newWithKeysValues(3L, 3L).minIfEmpty(5L));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method noneSatisfy.
@Test
public void noneSatisfy() {
LongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
Assert.assertTrue(this.getEmptyMap().noneSatisfy(LongPredicates.equal(0L)));
Assert.assertTrue(this.newWithKeysValues(1L, 1L).noneSatisfy(LongPredicates.equal(0L)));
Assert.assertFalse(this.newWithKeysValues(1L, 1L).noneSatisfy(LongPredicates.equal(1L)));
Assert.assertFalse(map.noneSatisfy(LongPredicates.equal(0L)));
Assert.assertFalse(map.noneSatisfy(LongPredicates.equal(1L)));
Assert.assertFalse(map.noneSatisfy(LongPredicates.equal(2L)));
Assert.assertTrue(map.noneSatisfy(LongPredicates.lessThan(0L)));
}
use of org.eclipse.collections.api.map.primitive.LongLongMap in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method reject_value.
@Test
public void reject_value() {
LongLongMap map = this.newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
LongIterable actual1 = map.reject(LongPredicates.lessThan(2L));
Assert.assertEquals(LongBags.immutable.with(2L, 3L), actual1);
LongIterable actual2 = map.reject(LongPredicates.greaterThan(1L));
Assert.assertEquals(LongBags.immutable.with(0L, 1L), actual2);
}
Aggregations