use of org.eclipse.collections.api.set.primitive.ImmutableByteSet 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);
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method toSortedArray.
@Override
@Test
public void toSortedArray() {
super.toSortedArray();
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
Assert.assertArrayEquals(new byte[] { (byte) 0, (byte) 1, (byte) 31 }, set.toSortedArray());
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method count.
@Override
@Test
public void count() {
super.count();
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) 127, (byte) -1, (byte) -31, (byte) -64, (byte) -65, (byte) -128);
Assert.assertEquals(3, set.count(BytePredicates.greaterThan((byte) 0)));
Assert.assertEquals(8, set.count(BytePredicates.lessThan((byte) 32)));
Assert.assertEquals(1, set.count(BytePredicates.greaterThan((byte) 32)));
}
Aggregations