Search in sources :

Example 11 with MutableLongSet

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

the class AbstractLongSetTestCase method testEquals.

@Override
@Test
public void testEquals() {
    super.testEquals();
    MutableLongSet set1 = this.newWith(1L, 31L, 32L);
    MutableLongSet set2 = this.newWith(32L, 31L, 1L);
    MutableLongSet set3 = this.newWith(32L, 32L, 31L, 1L);
    MutableLongSet set4 = this.newWith(32L, 32L, 31L, 1L, 1L);
    Verify.assertEqualsAndHashCode(set1, set2);
    Verify.assertEqualsAndHashCode(set1, set3);
    Verify.assertEqualsAndHashCode(set1, set4);
    Verify.assertEqualsAndHashCode(set2, set3);
    Verify.assertEqualsAndHashCode(set2, set4);
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 12 with MutableLongSet

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

the class AbstractLongSetTestCase method forEach.

@Override
@Test
public void forEach() {
    super.forEach();
    long[] sum = new long[1];
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    set.forEach((long each) -> sum[0] += each);
    Assert.assertEquals(32L + AbstractLongSetTestCase.generateCollisions1().getFirst() + AbstractLongSetTestCase.generateCollisions1().get(1), sum[0]);
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 13 with MutableLongSet

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

the class LongLongHashMapKeySetTest method testEquals.

@Override
public void testEquals() {
    MutableLongSet set1 = this.newWith(1L, 31L, 32L);
    MutableLongSet set2 = this.newWith(32L, 31L, 1L);
    MutableLongSet set3 = this.newWith(32L, 32L, 31L, 1L);
    MutableLongSet set4 = this.newWith(32L, 32L, 31L, 1L, 1L);
    MutableLongSet set5 = this.newWith(32L, 1L);
    Verify.assertEqualsAndHashCode(set1, set2);
    Verify.assertEqualsAndHashCode(set1, set3);
    Verify.assertEqualsAndHashCode(set1, set4);
    Verify.assertEqualsAndHashCode(set2, set3);
    Verify.assertEqualsAndHashCode(set2, set4);
    Assert.assertNotEquals(set1, set5);
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet)

Example 14 with MutableLongSet

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

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

the class AbstractLongSetTestCase method reject.

@Override
@Test
public void reject() {
    super.reject();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Verify.assertSize(1, set.reject(LongPredicates.greaterThan(0L)));
    Verify.assertSize(2, set.reject(LongPredicates.lessThan(32L)));
}
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