Search in sources :

Example 1 with MutableBooleanIterator

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

the class AbstractMutableBooleanCollectionTestCase method booleanIterator_with_remove.

@Test
public void booleanIterator_with_remove() {
    MutableBooleanCollection booleanIterable = this.classUnderTest();
    MutableBooleanIterator iterator = booleanIterable.booleanIterator();
    int iterationCount = booleanIterable.size();
    int iterableSize = booleanIterable.size();
    for (int i = 0; i < iterationCount; i++) {
        Verify.assertSize(iterableSize--, booleanIterable);
        Assert.assertTrue(iterator.hasNext());
        iterator.next();
        iterator.remove();
        Verify.assertSize(iterableSize, booleanIterable);
    }
    Verify.assertEmpty(booleanIterable);
    Assert.assertFalse(iterator.hasNext());
    Verify.assertThrows(NoSuchElementException.class, (Runnable) iterator::next);
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 2 with MutableBooleanIterator

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

the class UnmodifiableBooleanStackTest method booleanIterator_with_remove.

@Test
public void booleanIterator_with_remove() {
    MutableBooleanIterator booleanIterator = (MutableBooleanIterator) this.classUnderTest().booleanIterator();
    Assert.assertTrue(booleanIterator.hasNext());
    booleanIterator.next();
    Verify.assertThrows(UnsupportedOperationException.class, booleanIterator::remove);
}
Also used : MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 3 with MutableBooleanIterator

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

the class UnmodifiableObjectBooleanMapTest method iterator_throws_on_invocation_of_remove_before_next.

@Override
@Test
public void iterator_throws_on_invocation_of_remove_before_next() {
    UnmodifiableObjectBooleanMap<String> map = this.classUnderTest();
    MutableBooleanIterator booleanIterator = map.booleanIterator();
    Assert.assertTrue(booleanIterator.hasNext());
    Verify.assertThrows(UnsupportedOperationException.class, booleanIterator::remove);
}
Also used : MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 4 with MutableBooleanIterator

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

the class UnmodifiableObjectBooleanMapTest method iterator_remove.

@Override
@Test
public void iterator_remove() {
    UnmodifiableObjectBooleanMap<String> map = this.classUnderTest();
    Verify.assertNotEmpty(map);
    MutableBooleanIterator booleanIterator = map.booleanIterator();
    Assert.assertTrue(booleanIterator.hasNext());
    booleanIterator.next();
    Verify.assertThrows(UnsupportedOperationException.class, booleanIterator::remove);
}
Also used : MutableBooleanIterator(org.eclipse.collections.api.iterator.MutableBooleanIterator) Test(org.junit.Test)

Example 5 with MutableBooleanIterator

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

the class UnmodifiableBooleanBagTest method booleanIterator_with_remove.

@Override
@Test
public void booleanIterator_with_remove() {
    MutableBooleanIterator booleanIterator = this.classUnderTest().booleanIterator();
    Assert.assertTrue(booleanIterator.hasNext());
    booleanIterator.next();
    Verify.assertThrows(UnsupportedOperationException.class, booleanIterator::remove);
}
Also used : 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