Search in sources :

Example 16 with MutableBooleanIterator

use of org.eclipse.collections.api.iterator.MutableBooleanIterator in project eclipse-collections by eclipse.

the class AbstractMutableObjectBooleanMapTestCase method iterator_remove.

@Test
public void iterator_remove() {
    MutableObjectBooleanMap<String> map = this.classUnderTest();
    Verify.assertNotEmpty(map);
    MutableBooleanIterator booleanIterator = map.booleanIterator();
    while (booleanIterator.hasNext()) {
        booleanIterator.next();
        booleanIterator.remove();
    }
    Verify.assertEmpty(map);
}
Also used : MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 17 with MutableBooleanIterator

use of org.eclipse.collections.api.iterator.MutableBooleanIterator in project eclipse-collections by eclipse.

the class AbstractMutableBooleanCollectionTestCase method iterator_throws_on_consecutive_invocation_of_remove.

@Test
public void iterator_throws_on_consecutive_invocation_of_remove() {
    MutableBooleanCollection booleanIterable = this.newWith(true, false);
    MutableBooleanIterator iterator = booleanIterable.booleanIterator();
    iterator.next();
    iterator.remove();
    Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 18 with MutableBooleanIterator

use of org.eclipse.collections.api.iterator.MutableBooleanIterator in project eclipse-collections by eclipse.

the class AbstractMutableBooleanCollectionTestCase method iterator_throws_on_invocation_of_remove_before_next.

@Test
public void iterator_throws_on_invocation_of_remove_before_next() {
    MutableBooleanCollection booleanIterable = this.newWith(true, false);
    MutableBooleanIterator iterator = booleanIterable.booleanIterator();
    Assert.assertTrue(iterator.hasNext());
    Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Aggregations

MutableBooleanIterator (org.eclipse.collections.api.iterator.MutableBooleanIterator)18 Test (org.junit.Test)18 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)4 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)1 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)1