Search in sources :

Example 6 with LongArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.LongArrayList in project mapdb by jankotek.

the class AbstractLongSetTestCase method generateNonCollisions.

private static LongArrayList generateNonCollisions() {
    LongArrayList collisions = new LongArrayList();
    LongHashSet set = new LongHashSet();
    for (long i = 32L; collisions.size() <= 10; i++) {
        //            if (set.spreadAndMask(i) != set.spreadAndMask(32L))
        {
            collisions.add(i);
        }
    }
    return collisions;
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)

Example 7 with LongArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.LongArrayList in project mapdb by jankotek.

the class AbstractLongSetTestCase method removeAll_iterable.

@Override
@Test
public void removeAll_iterable() {
    super.removeAll_iterable();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(set.removeAll(new LongArrayList()));
    Assert.assertFalse(set.removeAll(LongArrayList.newListWith(15L, AbstractLongSetTestCase.generateCollisions1().get(2), AbstractLongSetTestCase.generateCollisions1().get(3))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.removeAll(LongHashSet.newSetWith(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(4))));
    Assert.assertEquals(LongHashSet.newSetWith(1L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.removeAll(LongHashSet.newSetWith(1L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(new LongHashSet(), set);
    Assert.assertFalse(set.removeAll(LongHashSet.newSetWith(1L)));
    Assert.assertEquals(new LongHashSet(), set);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) Test(org.junit.Test)

Example 8 with LongArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.LongArrayList in project mapdb by jankotek.

the class AbstractMutableLongLongMapTestCase method generateCollisions.

protected static LongArrayList generateCollisions() {
    LongArrayList collisions = new LongArrayList();
    LongLongHashMap hashMap = new LongLongHashMap();
    for (long each = 2L; collisions.size() <= 10; each++) {
        //            if (hashMap.spreadAndMask(each) == hashMap.spreadAndMask(2L))
        {
            collisions.add(each);
        }
    }
    return collisions;
}
Also used : LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) LongLongHashMap(org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap)

Example 9 with LongArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.LongArrayList in project mapdb by jankotek.

the class AbstractLongSetTestCase method addAllIterable.

@Override
@Test
public void addAllIterable() {
    super.addAllIterable();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(set.addAll(new LongArrayList()));
    Assert.assertFalse(set.addAll(LongArrayList.newListWith(31L, AbstractLongSetTestCase.generateCollisions1().get(0), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.addAll(LongHashSet.newSetWith(0L, 1L, 2L, 30L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(4))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 2L, 30L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1), AbstractLongSetTestCase.generateCollisions1().get(4)), set);
    Assert.assertTrue(set.addAll(LongHashSet.newSetWith(5L)));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 2L, 5L, 30L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1), AbstractLongSetTestCase.generateCollisions1().get(4)), set);
    Assert.assertTrue(set.addAll(LongHashSet.newSetWith(AbstractLongSetTestCase.generateCollisions1().get(5))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 2L, 5L, 30L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1), AbstractLongSetTestCase.generateCollisions1().get(4), AbstractLongSetTestCase.generateCollisions1().get(5)), set);
    LongHashSet set1 = new LongHashSet();
    Assert.assertTrue(set1.addAll(2L, 35L));
    Assert.assertEquals(LongHashSet.newSetWith(2L, 35L), set1);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) Test(org.junit.Test)

Example 10 with LongArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.LongArrayList in project mapdb by jankotek.

the class AbstractLongSetTestCase method generateCollisions1.

protected static LongArrayList generateCollisions1() {
    LongArrayList collisions = new LongArrayList();
    LongHashSet set = new LongHashSet();
    for (long i = 32L; collisions.size() <= 10; i++) {
        //            if (set.spreadAndMask(i) == set.spreadAndMask(32L))
        {
            collisions.add(i);
        }
    }
    return collisions;
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)

Aggregations

LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)12 Test (org.junit.Test)9 MutableLongCollection (org.eclipse.collections.api.collection.primitive.MutableLongCollection)5 LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)4 LazyLongIterable (org.eclipse.collections.api.LazyLongIterable)2 LongIterable (org.eclipse.collections.api.LongIterable)2 MutableLongLongMap (org.eclipse.collections.api.map.primitive.MutableLongLongMap)2 MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)2 LongIterator (org.eclipse.collections.api.iterator.LongIterator)1 LongLongHashMap (org.eclipse.collections.impl.map.mutable.primitive.LongLongHashMap)1