Search in sources :

Example 11 with MutableByteSet

use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.

the class AbstractByteSetTestCase method asSynchronized.

@Override
@Test
public void asSynchronized() {
    super.asSynchronized();
    MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -31, (byte) -24);
    Verify.assertInstanceOf(SynchronizedByteSet.class, set.asSynchronized());
    Assert.assertEquals(new SynchronizedByteSet(set), set.asSynchronized());
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) Test(org.junit.Test)

Example 12 with MutableByteSet

use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.

the class AbstractByteSetTestCase method forEach.

@Override
@Test
public void forEach() {
    super.forEach();
    long[] sum = new long[1];
    MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) 63, (byte) 65, (byte) 100, (byte) 127, (byte) 12, (byte) -76, (byte) -1, (byte) -54, (byte) -64, (byte) -63, (byte) -95, (byte) -128, (byte) -127);
    set.forEach(each -> sum[0] += each);
    Assert.assertEquals(-209L, sum[0]);
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) Test(org.junit.Test)

Example 13 with MutableByteSet

use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.

the class AbstractByteSetTestCase method testHashCode.

@Override
@Test
public void testHashCode() {
    super.testEquals();
    MutableByteSet set1 = this.newWith((byte) 1, (byte) 31, (byte) 32);
    MutableByteSet set2 = this.newWith((byte) 32, (byte) 31, (byte) 1);
    Assert.assertEquals(set1.hashCode(), set2.hashCode());
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) Test(org.junit.Test)

Example 14 with MutableByteSet

use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.

the class AbstractByteSetTestCase method clear.

@Override
@Test
public void clear() {
    super.clear();
    MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -128);
    set.clear();
    Verify.assertSize(0, set);
    Assert.assertFalse(set.contains((byte) 0));
    Assert.assertFalse(set.contains((byte) 31));
    Assert.assertFalse(set.contains((byte) 1));
    Assert.assertFalse(set.contains((byte) -1));
    Assert.assertFalse(set.contains((byte) -128));
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) Test(org.junit.Test)

Example 15 with MutableByteSet

use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.

the class AbstractByteSetTestCase method asLazy.

@Override
@Test
public void asLazy() {
    super.asLazy();
    MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -31, (byte) -24);
    Assert.assertEquals(set.toSet(), set.asLazy().toSet());
    Verify.assertInstanceOf(LazyByteIterable.class, set.asLazy());
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) Test(org.junit.Test)

Aggregations

MutableByteSet (org.eclipse.collections.api.set.primitive.MutableByteSet)25 Test (org.junit.Test)21 ByteIterator (org.eclipse.collections.api.iterator.ByteIterator)4 ByteArrayList (org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList)3 LazyByteIterable (org.eclipse.collections.api.LazyByteIterable)2 ByteHashSet (org.eclipse.collections.impl.set.mutable.primitive.ByteHashSet)2 NoSuchElementException (java.util.NoSuchElementException)1 ByteIterable (org.eclipse.collections.api.ByteIterable)1 MutableByteIterator (org.eclipse.collections.api.iterator.MutableByteIterator)1 MutableSet (org.eclipse.collections.api.set.MutableSet)1 ByteHashBag (org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag)1 BytePredicates (org.eclipse.collections.impl.block.factory.primitive.BytePredicates)1 AbstractMutableByteCollectionTestCase (org.eclipse.collections.impl.collection.mutable.primitive.AbstractMutableByteCollectionTestCase)1 ByteSets (org.eclipse.collections.impl.factory.primitive.ByteSets)1 UnifiedSet (org.eclipse.collections.impl.set.mutable.UnifiedSet)1 Verify (org.eclipse.collections.impl.test.Verify)1 Assert (org.junit.Assert)1