Search in sources :

Example 26 with MutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.

the class AbstractMutableBooleanBagTestCase method testEquals.

@Override
@Test
public void testEquals() {
    super.testEquals();
    MutableBooleanCollection collection1 = this.newWith(true, false, true, false);
    MutableBooleanCollection collection2 = this.newWith(true, false, false, true);
    MutableBooleanCollection collection3 = this.newWith(true, false);
    MutableBooleanCollection collection4 = this.newWith(true, true, false);
    Assert.assertEquals(collection1, collection2);
    Assert.assertNotEquals(collection3, collection4);
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) Test(org.junit.Test)

Example 27 with MutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.

the class IterateTest method collectBoolean.

@Test
public void collectBoolean() {
    this.iterables.each(each -> {
        MutableBooleanCollection result = Iterate.collectBoolean(each, PrimitiveFunctions.integerIsPositive());
        Assert.assertTrue(result.containsAll(true, true, true, true, true));
    });
    Verify.assertThrows(IllegalArgumentException.class, () -> Iterate.collectBoolean(null, PrimitiveFunctions.integerIsPositive()));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) Test(org.junit.Test)

Example 28 with MutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.

the class MapIterateTest method collectBoolean.

@Test
public void collectBoolean() {
    MutableBooleanCollection result = MapIterate.collectBoolean(MapIterateTest.newLittleMap(), PrimitiveFunctions.integerIsPositive());
    Assert.assertEquals(BooleanHashBag.newBagWith(true, true), result.toBag());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) Test(org.junit.Test)

Example 29 with MutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.

the class ObjectBooleanHashMapValuesTestCase method removeAll.

@Override
@Test
public void removeAll() {
    Assert.assertFalse(this.newWith().removeAll());
    ObjectBooleanHashMap<Integer> map = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection = map.values();
    Assert.assertFalse(collection.removeAll());
    Assert.assertTrue(collection.removeAll(false));
    Assert.assertFalse(collection.contains(false));
    Assert.assertTrue(collection.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.contains(true));
    Assert.assertTrue(collection.removeAll(true));
    Assert.assertTrue(collection.isEmpty());
    Assert.assertFalse(collection.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.isEmpty());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) Test(org.junit.Test)

Example 30 with MutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.

the class ObjectBooleanHashMapValuesTestCase method asSynchronized.

@Override
@Test
public void asSynchronized() {
    MutableBooleanCollection synch = this.classUnderTest().asSynchronized();
    Verify.assertInstanceOf(SynchronizedBooleanCollection.class, synch);
    Assert.assertTrue(synch.containsAll(this.classUnderTest()));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) Test(org.junit.Test)

Aggregations

MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)45 Test (org.junit.Test)43 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)11 MutableByteCollection (org.eclipse.collections.api.collection.primitive.MutableByteCollection)4 MutableCharCollection (org.eclipse.collections.api.collection.primitive.MutableCharCollection)4 MutableDoubleCollection (org.eclipse.collections.api.collection.primitive.MutableDoubleCollection)4 MutableFloatCollection (org.eclipse.collections.api.collection.primitive.MutableFloatCollection)4 MutableIntCollection (org.eclipse.collections.api.collection.primitive.MutableIntCollection)4 MutableLongCollection (org.eclipse.collections.api.collection.primitive.MutableLongCollection)4 MutableShortCollection (org.eclipse.collections.api.collection.primitive.MutableShortCollection)4 MutableBooleanIterator (org.eclipse.collections.api.iterator.MutableBooleanIterator)4 Optional (java.util.Optional)3 RichIterable (org.eclipse.collections.api.RichIterable)3 MutableCollection (org.eclipse.collections.api.collection.MutableCollection)3 MutableList (org.eclipse.collections.api.list.MutableList)3 Pair (org.eclipse.collections.api.tuple.Pair)3 Predicates2 (org.eclipse.collections.impl.block.factory.Predicates2)3 Lists (org.eclipse.collections.impl.factory.Lists)3 List (java.util.List)2 Map (java.util.Map)2