use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class LongLongHashMapKeySetTest method testHashCode.
@Override
public void testHashCode() {
MutableLongSet set1 = this.newWith(0L, 1L, 31L, 32L);
MutableLongSet set2 = this.newWith(32L, 31L, 1L, 0L);
Assert.assertEquals(set1.hashCode(), set2.hashCode());
// Assert.assertEquals(this.newObjectCollectionWith(0L, 1L, 31L, 32L).hashCode(), set1.hashCode());
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method longIterator.
@Override
@Test
public void longIterator() {
MutableSet<Long> expected = UnifiedSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
MutableSet<Long> actual = UnifiedSet.newSet();
MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
LongIterator iterator = set.longIterator();
Assert.assertTrue(iterator.hasNext());
actual.add(iterator.next());
Assert.assertTrue(iterator.hasNext());
actual.add(iterator.next());
Assert.assertTrue(iterator.hasNext());
actual.add(iterator.next());
Assert.assertTrue(iterator.hasNext());
actual.add(iterator.next());
Assert.assertTrue(iterator.hasNext());
actual.add(iterator.next());
Assert.assertFalse(iterator.hasNext());
Assert.assertEquals(expected, actual);
Verify.assertThrows(NoSuchElementException.class, iterator::next);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method longIterator_throws.
@Override
@Test(expected = NoSuchElementException.class)
public void longIterator_throws() {
MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
LongIterator iterator = set.longIterator();
while (iterator.hasNext()) {
iterator.next();
}
iterator.next();
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method toSortedArray.
@Override
@Test
public void toSortedArray() {
super.toSortedArray();
MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
Assert.assertArrayEquals(new long[] { 0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1) }, set.toSortedArray());
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet 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);
}
Aggregations