Search in sources :

Example 6 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method add.

@Override
@Test
public void add() {
    super.add();
    MutableLongSet set = this.newWith();
    Assert.assertTrue(set.add(14L));
    Assert.assertFalse(set.add(14L));
    Assert.assertTrue(set.add(2L));
    Assert.assertFalse(set.add(2L));
    Assert.assertTrue(set.add(35L));
    Assert.assertFalse(set.add(35L));
    Assert.assertTrue(set.add(31L));
    Assert.assertFalse(set.add(31L));
    Assert.assertTrue(set.add(32L));
    Assert.assertFalse(set.add(32L));
    Assert.assertTrue(set.add(0L));
    Assert.assertFalse(set.add(0L));
    Assert.assertTrue(set.add(1L));
    Assert.assertFalse(set.add(1L));
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 7 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method collect.

@Override
@Test
public void collect() {
    super.collect();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertEquals(UnifiedSet.newSetWith(-1L, 0L, 30L, AbstractLongSetTestCase.generateCollisions1().getFirst() - 1, AbstractLongSetTestCase.generateCollisions1().get(1) - 1), set.collect((long byteParameter) -> byteParameter - 1));
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 8 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method asUnmodifiable.

@Override
@Test
public void asUnmodifiable() {
    super.asUnmodifiable();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Verify.assertInstanceOf(UnmodifiableLongSet.class, set.asUnmodifiable());
//        Assert.assertEquals(new UnmodifiableLongSet(set), set.asUnmodifiable());
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 9 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet 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 10 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method asSynchronized.

@Override
@Test
public void asSynchronized() {
    super.asSynchronized();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Verify.assertInstanceOf(SynchronizedLongSet.class, set.asSynchronized());
//        Assert.assertEquals(new SynchronizedLongSet(set), set.asSynchronized());
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Aggregations

MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)26 Test (org.junit.Test)24 LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)5 LongIterator (org.eclipse.collections.api.iterator.LongIterator)3 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2