Search in sources :

Example 1 with LongIterator

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);
}
Also used : LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) LongIterator(org.eclipse.collections.api.iterator.LongIterator) Test(org.junit.Test)

Example 2 with LongIterator

use of org.eclipse.collections.api.iterator.LongIterator 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);
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) LongIterator(org.eclipse.collections.api.iterator.LongIterator) Test(org.junit.Test)

Example 3 with LongIterator

use of org.eclipse.collections.api.iterator.LongIterator 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();
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) LongIterator(org.eclipse.collections.api.iterator.LongIterator) Test(org.junit.Test)

Example 4 with LongIterator

use of org.eclipse.collections.api.iterator.LongIterator in project narchy by automenta.

the class Conj method shift.

public long shift() {
    long min = Long.MAX_VALUE;
    LongIterator ii = event.keysView().longIterator();
    while (ii.hasNext()) {
        long t = ii.next();
        if (t != DTERNAL) {
            if (t < min)
                min = t;
        }
    }
    return min;
}
Also used : LongIterator(org.eclipse.collections.api.iterator.LongIterator)

Example 5 with LongIterator

use of org.eclipse.collections.api.iterator.LongIterator 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();
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) LongIterator(org.eclipse.collections.api.iterator.LongIterator) Test(org.junit.Test)

Aggregations

LongIterator (org.eclipse.collections.api.iterator.LongIterator)45 Test (org.junit.Test)16 Test (org.junit.jupiter.api.Test)15 MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)9 MutableLongIterator (org.eclipse.collections.api.iterator.MutableLongIterator)5 MutableLongCollection (org.eclipse.collections.api.collection.primitive.MutableLongCollection)4 LongSet (org.eclipse.collections.api.set.primitive.LongSet)3 IndexReaderStub (org.neo4j.kernel.api.impl.index.IndexReaderStub)3 LazyLongIterable (org.eclipse.collections.api.LazyLongIterable)2 LongIterable (org.eclipse.collections.api.LongIterable)2 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 RelationshipChangesForNode.createRelationshipChangesForNode (org.neo4j.kernel.impl.api.state.RelationshipChangesForNode.createRelationshipChangesForNode)2 IOException (java.io.IOException)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 MutableLongList (org.eclipse.collections.api.list.primitive.MutableLongList)1 ImmutableEmptyLongIterator (org.eclipse.collections.impl.iterator.ImmutableEmptyLongIterator)1 AbstractPrimitiveLongBaseIterator (org.neo4j.collection.PrimitiveLongCollections.AbstractPrimitiveLongBaseIterator)1 RangeLongIterator (org.neo4j.collection.RangeLongIterator)1