Search in sources :

Example 21 with LongLongMap

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()));
}
Also used : ImmutableLongLongMap(org.eclipse.collections.api.map.primitive.ImmutableLongLongMap) LongLongMap(org.eclipse.collections.api.map.primitive.LongLongMap) Test(org.junit.Test)

Example 22 with LongLongMap

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());
}
Also used : ImmutableLongLongMap(org.eclipse.collections.api.map.primitive.ImmutableLongLongMap) LongLongMap(org.eclipse.collections.api.map.primitive.LongLongMap) Test(org.junit.Test)

Example 23 with LongLongMap

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));
}
Also used : ImmutableLongLongMap(org.eclipse.collections.api.map.primitive.ImmutableLongLongMap) LongLongMap(org.eclipse.collections.api.map.primitive.LongLongMap) Test(org.junit.Test)

Example 24 with LongLongMap

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)));
}
Also used : ImmutableLongLongMap(org.eclipse.collections.api.map.primitive.ImmutableLongLongMap) LongLongMap(org.eclipse.collections.api.map.primitive.LongLongMap) Test(org.junit.Test)

Example 25 with LongLongMap

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);
}
Also used : LazyLongIterable(org.eclipse.collections.api.LazyLongIterable) LongIterable(org.eclipse.collections.api.LongIterable) ImmutableLongLongMap(org.eclipse.collections.api.map.primitive.ImmutableLongLongMap) LongLongMap(org.eclipse.collections.api.map.primitive.LongLongMap) Test(org.junit.Test)

Aggregations

ImmutableLongLongMap (org.eclipse.collections.api.map.primitive.ImmutableLongLongMap)30 LongLongMap (org.eclipse.collections.api.map.primitive.LongLongMap)30 Test (org.junit.Test)30 LazyLongIterable (org.eclipse.collections.api.LazyLongIterable)3 LongIterable (org.eclipse.collections.api.LongIterable)3 Arrays (java.util.Arrays)1 NoSuchElementException (java.util.NoSuchElementException)1 MutableBag (org.eclipse.collections.api.bag.MutableBag)1 LongToObjectFunction (org.eclipse.collections.api.block.function.primitive.LongToObjectFunction)1 LongIterator (org.eclipse.collections.api.iterator.LongIterator)1 MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)1 LongLongPair (org.eclipse.collections.api.tuple.primitive.LongLongPair)1 LongHashBag (org.eclipse.collections.impl.bag.mutable.primitive.LongHashBag)1 LongPredicates (org.eclipse.collections.impl.block.factory.primitive.LongPredicates)1 Bags (org.eclipse.collections.impl.factory.Bags)1 LongBags (org.eclipse.collections.impl.factory.primitive.LongBags)1 LongLongMaps (org.eclipse.collections.impl.factory.primitive.LongLongMaps)1 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)1 LongLongHashMap (org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap)1 LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)1