Search in sources :

Example 6 with LongHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.LongHashSet 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)

Example 7 with LongHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.LongHashSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method retainAll_iterable.

@Override
@Test
public void retainAll_iterable() {
    super.retainAll_iterable();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(set.retainAll(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.retainAll(LongHashSet.newSetWith(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(4), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.retainAll(LongHashSet.newSetWith(1L, AbstractLongSetTestCase.generateCollisions1().getFirst())));
    Assert.assertEquals(new LongHashSet(), set);
    Assert.assertFalse(set.retainAll(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) Test(org.junit.Test)

Aggregations

LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)7 MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)5 Test (org.junit.Test)5 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)4