Search in sources :

Example 1 with LongHashSet

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

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

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

the class AbstractLongSetTestCase method retainAll.

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

Example 4 with LongHashSet

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

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

the class AbstractLongSetTestCase method removeAll.

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