Search in sources :

Example 1 with ImmutableByteSet

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]);
}
Also used : ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Example 2 with ImmutableByteSet

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());
}
Also used : ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Example 3 with ImmutableByteSet

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));
}
Also used : ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Example 4 with ImmutableByteSet

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());
}
Also used : ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Example 5 with ImmutableByteSet

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)));
}
Also used : AbstractImmutableByteCollectionTestCase(org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableByteCollectionTestCase) LazyByteIterable(org.eclipse.collections.api.LazyByteIterable) MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) ByteHashBag(org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag) Test(org.junit.Test) Verify(org.eclipse.collections.impl.test.Verify) ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) MutableSet(org.eclipse.collections.api.set.MutableSet) ByteIterator(org.eclipse.collections.api.iterator.ByteIterator) NoSuchElementException(java.util.NoSuchElementException) Assert(org.junit.Assert) BytePredicates(org.eclipse.collections.impl.block.factory.primitive.BytePredicates) UnifiedSet(org.eclipse.collections.impl.set.mutable.UnifiedSet) ImmutableByteSet(org.eclipse.collections.api.set.primitive.ImmutableByteSet) Test(org.junit.Test)

Aggregations

ImmutableByteSet (org.eclipse.collections.api.set.primitive.ImmutableByteSet)13 Test (org.junit.Test)12 ByteIterator (org.eclipse.collections.api.iterator.ByteIterator)3 NoSuchElementException (java.util.NoSuchElementException)1 Op (nars.Op)1 LazyByteIterable (org.eclipse.collections.api.LazyByteIterable)1 MutableSet (org.eclipse.collections.api.set.MutableSet)1 MutableByteSet (org.eclipse.collections.api.set.primitive.MutableByteSet)1 ByteHashBag (org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag)1 BytePredicates (org.eclipse.collections.impl.block.factory.primitive.BytePredicates)1 AbstractImmutableByteCollectionTestCase (org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableByteCollectionTestCase)1 UnifiedSet (org.eclipse.collections.impl.set.mutable.UnifiedSet)1 Verify (org.eclipse.collections.impl.test.Verify)1 Assert (org.junit.Assert)1