use of org.eclipse.collections.api.iterator.LongIterator in project mapdb by jankotek.
the class LongLongHashMapValuesTest method longIterator.
@Override
@Test
public void longIterator() {
MutableLongCollection bag = this.newWith(0L, 1L, 2L, 3L);
LongArrayList list = LongArrayList.newListWith(0L, 1L, 2L, 3L);
LongIterator iterator = bag.longIterator();
for (int i = 0; i < 4; i++) {
Assert.assertTrue(iterator.hasNext());
Assert.assertTrue(list.remove(iterator.next()));
}
Verify.assertEmpty(list);
Assert.assertFalse(iterator.hasNext());
Verify.assertThrows(NoSuchElementException.class, iterator::next);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class RecordIdIteratorTest method assertIds.
private static void assertIds(RecordIdIterator ids, long[]... expectedIds) {
for (long[] expectedArray : expectedIds) {
LongIterator iterator = ids.nextBatch();
assertNotNull(iterator);
for (long expectedId : expectedArray) {
assertEquals(expectedId, iterator.next());
}
assertFalse(iterator.hasNext());
}
assertNull(ids.nextBatch());
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class DocValuesCollectorTest method shouldSilentlyMergeSegmentsWhenReturnDocValuesInOrder.
@Test
void shouldSilentlyMergeSegmentsWhenReturnDocValuesInOrder() throws Exception {
// given
DocValuesCollector collector = new DocValuesCollector(true);
IndexReaderStub readerStub = indexReaderWithMaxDocs(42);
// when
collector.doSetNextReader(readerStub.getContext());
collector.setScorer(constantScorer(1.0f));
collector.collect(1);
collector.doSetNextReader(readerStub.getContext());
collector.setScorer(constantScorer(2.0f));
collector.collect(2);
// then
LongIterator valuesIterator = collector.getValuesSortedByRelevance("id");
assertEquals(2, valuesIterator.next());
assertEquals(1, valuesIterator.next());
assertFalse(valuesIterator.hasNext());
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class IndexingCompositeQueryAcceptanceTest method shouldNotIncludeEntitiesDeletedInSameTxInIndexSeek.
@ParameterizedTest(name = "shouldNotIncludeEntitiesDeletedInSameTxInIndexSeek using {0} with {1} index for {2}")
@MethodSource("data")
public void shouldNotIncludeEntitiesDeletedInSameTxInIndexSeek(DataSet dataSet, IndexingMode withIndex, EntityControl entityControl) {
createIndex(withIndex, dataSet.keys, entityControl);
// GIVEN
createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.nonMatching[0]);
LongSet toDelete = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.values, dataSet.nonMatching[1], dataSet.nonMatching[2]);
MutableLongSet expected = createEntities(db, entityControl, TOKEN_NAME, dataSet.keys, dataSet.values);
// WHEN
LongSet found;
try (Transaction tx = db.beginTx()) {
LongIterator deleting = toDelete.longIterator();
while (deleting.hasNext()) {
long id = deleting.next();
entityControl.deleteEntity(tx, id);
expected.remove(id);
}
found = dataSet.indexSeek.findEntities(tx, dataSet.keys, dataSet.values, entityControl);
}
// THEN
assertThat(found).isEqualTo(expected);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class MutableLinearProbeLongHashSetTest method frozenIteratorFailsWhenParentSetIsClosed.
@Test
void frozenIteratorFailsWhenParentSetIsClosed() {
set.addAll(1, 2, 3, 100, 200, 300);
final LongIterator iter = set.freeze().longIterator();
set.close();
assertThrows(ConcurrentModificationException.class, iter::hasNext);
assertThrows(ConcurrentModificationException.class, iter::next);
}
Aggregations