use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongCollectionsTest method arrayOfItemsAsIterator.
@Test
void arrayOfItemsAsIterator() {
// GIVEN
long[] items = new long[] { 2, 5, 234 };
// WHEN
LongIterator iterator = PrimitiveLongCollections.iterator(items);
// THEN
assertItems(iterator, items);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongCollectionsTest method singleIterator.
@Test
void singleIterator() {
LongIterator iterator = PrimitiveLongCollections.single(42);
assertTrue(iterator.hasNext());
assertEquals(42, iterator.next());
assertFalse(iterator.hasNext());
assertThrows(NoSuchElementException.class, iterator::next);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongCollectionsTest method asArray.
@Test
void asArray() {
// GIVEN
LongIterator items = PrimitiveLongCollections.iterator(1, 2, 3);
// WHEN
long[] array = PrimitiveLongCollections.asArray(items);
// THEN
assertArrayEquals(new long[] { 1, 2, 3 }, array);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongArrayQueueTest method tailBeforeHeadCorrectIteration.
@Test
void tailBeforeHeadCorrectIteration() {
PrimitiveLongArrayQueue queue = createQueue();
for (int i = 0; i < 14; i++) {
queue.enqueue(i);
}
for (int i = 0; i < 10; i++) {
assertEquals(i, queue.dequeue());
}
for (int i = 14; i < 24; i++) {
queue.enqueue(i);
}
assertEquals(14, queue.size());
LongIterator iterator = queue.longIterator();
for (int j = 10; j < 24; j++) {
assertTrue(iterator.hasNext());
assertEquals(j, iterator.next());
}
assertFalse(iterator.hasNext());
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class DocValuesCollectorTest method shouldReturnDocValuesInRelevanceOrder.
@Test
void shouldReturnDocValuesInRelevanceOrder() 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.setScorer(constantScorer(2.0f));
collector.collect(2);
// then
LongIterator valuesIterator = collector.getValuesSortedByRelevance("id");
assertEquals(2, valuesIterator.next());
assertEquals(1, valuesIterator.next());
assertFalse(valuesIterator.hasNext());
}
Aggregations