use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method forEach.
@Override
@Test
public void forEach() {
super.forEach();
long[] sum = new long[1];
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
set.forEach(each -> sum[0] += each);
Assert.assertEquals(32L, sum[0]);
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method testHashCode.
@Override
@Test
public void testHashCode() {
super.testEquals();
ImmutableByteSet set1 = this.newWith((byte) 1, (byte) 31, (byte) 32);
ImmutableByteSet set2 = this.newWith((byte) 32, (byte) 31, (byte) 1);
Assert.assertEquals(set1.hashCode(), set2.hashCode());
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method detectIfNone.
@Override
@Test
public void detectIfNone() {
super.detectIfNone();
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
Assert.assertEquals((byte) 0, set.detectIfNone(BytePredicates.lessThan((byte) 1), (byte) 9));
Assert.assertEquals((byte) 31, set.detectIfNone(BytePredicates.greaterThan((byte) 1), (byte) 9));
Assert.assertEquals((byte) 9, set.detectIfNone(BytePredicates.greaterThan((byte) 31), (byte) 9));
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method asLazy.
@Override
@Test
public void asLazy() {
super.asLazy();
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
Assert.assertEquals(set.toSet(), set.asLazy().toSet());
Verify.assertInstanceOf(LazyByteIterable.class, set.asLazy());
}
use of org.eclipse.collections.api.set.primitive.ImmutableByteSet in project eclipse-collections by eclipse.
the class AbstractImmutableByteHashSetTestCase method collect.
@Override
@Test
public void collect() {
super.collect();
ImmutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31);
Assert.assertEquals(UnifiedSet.newSetWith((byte) -1, (byte) 0, (byte) 30), set.collect(byteParameter -> (byte) (byteParameter - 1)));
}
Aggregations