Search in sources :

Example 1 with MutableLongIterator

use of org.eclipse.collections.api.iterator.MutableLongIterator in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method longIterator_throws_for_remove_before_next.

@Test
public void longIterator_throws_for_remove_before_next() {
    MutableLongCollection longIterable = this.classUnderTest();
    final MutableLongIterator iterator = longIterable.longIterator();
    Assert.assertTrue(iterator.hasNext());
    Verify.assertThrows(IllegalStateException.class, new Runnable() {

        @Override
        public void run() {
            iterator.remove();
        }
    });
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Example 2 with MutableLongIterator

use of org.eclipse.collections.api.iterator.MutableLongIterator in project mapdb by jankotek.

the class AbstractMutableLongLongMapTestCase method iterator_throws_on_consecutive_invocation_of_remove.

@Test
public void iterator_throws_on_consecutive_invocation_of_remove() {
    MutableLongIterator iterator = this.classUnderTest().longIterator();
    Assert.assertTrue(iterator.hasNext());
    iterator.next();
    iterator.remove();
    Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
Also used : MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Example 3 with MutableLongIterator

use of org.eclipse.collections.api.iterator.MutableLongIterator in project mapdb by jankotek.

the class AbstractMutableLongLongMapTestCase method iterator_throws_on_invocation_of_remove_before_next.

@Test
public void iterator_throws_on_invocation_of_remove_before_next() {
    MutableLongIterator iterator = this.classUnderTest().longIterator();
    Assert.assertTrue(iterator.hasNext());
    Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
Also used : MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Example 4 with MutableLongIterator

use of org.eclipse.collections.api.iterator.MutableLongIterator in project mapdb by jankotek.

the class AbstractMutableLongLongMapTestCase method longIterator_with_remove.

@Test
public void longIterator_with_remove() {
    MutableLongLongMap mutableMap = this.classUnderTest();
    MutableLongIterator iterator = mutableMap.longIterator();
    while (iterator.hasNext()) {
        iterator.next();
        iterator.remove();
    }
    Assert.assertFalse(iterator.hasNext());
    Verify.assertEmpty(mutableMap);
    Verify.assertThrows(NoSuchElementException.class, iterator::next);
}
Also used : MutableLongLongMap(org.eclipse.collections.api.map.primitive.MutableLongLongMap) MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Example 5 with MutableLongIterator

use of org.eclipse.collections.api.iterator.MutableLongIterator in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method longIterator_with_remove.

@Test
public void longIterator_with_remove() {
    MutableLongCollection longIterable = this.newWith(0L, 1L, 31L, 32L);
    final MutableLongIterator iterator = longIterable.longIterator();
    while (iterator.hasNext()) {
        iterator.next();
        iterator.remove();
    }
    Verify.assertEmpty(longIterable);
    Verify.assertThrows(NoSuchElementException.class, new Runnable() {

        @Override
        public void run() {
            iterator.next();
        }
    });
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Aggregations

MutableLongIterator (org.eclipse.collections.api.iterator.MutableLongIterator)6 Test (org.junit.Test)6 MutableLongCollection (org.eclipse.collections.api.collection.primitive.MutableLongCollection)3 MutableLongLongMap (org.eclipse.collections.api.map.primitive.MutableLongLongMap)1