use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongLongMapTestCase method longIterator.
@Test
public void longIterator() {
MutableLongSet expected = LongHashSet.newSetWith(0L, 31L, 32L);
MutableLongSet actual = LongHashSet.newSetWith();
LongIterator iterator = this.map.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.assertFalse(iterator.hasNext());
Assert.assertEquals(expected, actual);
Verify.assertThrows(NoSuchElementException.class, iterator::next);
Verify.assertThrows(NoSuchElementException.class, () -> this.getEmptyMap().longIterator().next());
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method asLazy.
@Override
@Test
public void asLazy() {
super.asLazy();
MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
Assert.assertEquals(set.toSet(), set.asLazy().toSet());
Verify.assertInstanceOf(LazyLongIterable.class, set.asLazy());
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method injectInto.
@Override
@Test
public void injectInto() {
super.injectInto();
MutableLongSet set = this.newWith(0L, 2L, 31L);
Long sum = set.injectInto(Long.valueOf(0L), (Long result, long value) -> Long.valueOf((long) (result + value)));
Assert.assertEquals(Long.valueOf(33L), sum);
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method testHashCode.
@Override
@Test
public void testHashCode() {
super.testEquals();
MutableLongSet set1 = this.newWith(1L, 31L, 32L);
MutableLongSet set2 = this.newWith(32L, 31L, 1L);
Assert.assertEquals(set1.hashCode(), set2.hashCode());
}
use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.
the class AbstractLongSetTestCase method count.
@Override
@Test
public void count() {
super.count();
MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
Assert.assertEquals(4L, set.count(LongPredicates.greaterThan(0L)));
Assert.assertEquals(3L, set.count(LongPredicates.lessThan(32L)));
Assert.assertEquals(1L, set.count(LongPredicates.greaterThan(32L)));
}
Aggregations