Search in sources :

Example 11 with ByteIterator

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

the class AbstractImmutableByteHashSetTestCase method byteIterator_throws.

@Override
@Test(expected = NoSuchElementException.class)
public void byteIterator_throws() {
    ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
    ByteIterator iterator = set.byteIterator();
    while (iterator.hasNext()) {
        iterator.next();
    }
    iterator.next();
}
Also used : ByteIterator(org.eclipse.collections.api.iterator.ByteIterator) ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Example 12 with ByteIterator

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

the class AbstractImmutableByteHashSetTestCase method byteIterator.

@Override
@Test
public void byteIterator() {
    MutableSet<Byte> expected = UnifiedSet.newSetWith((byte) 0, (byte) 1, (byte) 31);
    MutableSet<Byte> actual = UnifiedSet.newSet();
    ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
    ByteIterator iterator = set.byteIterator();
    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, (Runnable) iterator::next);
}
Also used : ByteIterator(org.eclipse.collections.api.iterator.ByteIterator) ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Aggregations

ByteIterator (org.eclipse.collections.api.iterator.ByteIterator)12 MutableByteIterator (org.eclipse.collections.api.iterator.MutableByteIterator)8 Test (org.junit.Test)4 MutableByteSet (org.eclipse.collections.api.set.primitive.MutableByteSet)3 ImmutableByteSet (org.eclipse.collections.api.set.primitive.ImmutableByteSet)2 IOException (java.io.IOException)1 ByteIterable (org.eclipse.collections.api.ByteIterable)1 LazyByteIterable (org.eclipse.collections.api.LazyByteIterable)1