Search in sources :

Example 16 with MutableBooleanCollection

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

the class ObjectBooleanHashMapValuesTestCase method asUnmodifiable.

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

Example 17 with MutableBooleanCollection

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

the class ObjectBooleanHashMapValuesTestCase method containsAllArray.

@Override
public void containsAllArray() {
    MutableBooleanCollection emptyCollection = this.newWith();
    Assert.assertFalse(emptyCollection.containsAll(true));
    Assert.assertFalse(emptyCollection.containsAll(false));
    Assert.assertFalse(emptyCollection.containsAll(false, true, false));
    MutableBooleanCollection collection = this.classUnderTest();
    Assert.assertTrue(collection.containsAll());
    Assert.assertTrue(collection.containsAll(true));
    Assert.assertTrue(collection.containsAll(false));
    Assert.assertTrue(collection.containsAll(false, true));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)

Example 18 with MutableBooleanCollection

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

the class ObjectBooleanHashMapValuesTestCase method removeAll_iterable.

@Override
@Test
public void removeAll_iterable() {
    Assert.assertFalse(this.newWith().removeAll(new BooleanArrayList()));
    ObjectBooleanHashMap<Integer> map = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection = map.values();
    Assert.assertFalse(collection.removeAll());
    Assert.assertTrue(collection.removeAll(BooleanArrayList.newListWith(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(BooleanArrayList.newListWith(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());
    ObjectBooleanHashMap<Integer> map1 = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection1 = map1.values();
    Assert.assertTrue(collection1.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(collection1.isEmpty());
    Assert.assertFalse(collection1.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map1.contains(true));
    Assert.assertFalse(map1.contains(false));
    Assert.assertTrue(map1.isEmpty());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 19 with MutableBooleanCollection

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

the class ObjectBooleanHashMapValuesTestCase method retainAll.

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

Example 20 with MutableBooleanCollection

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

the class ObjectBooleanHashMapValuesTestCase method containsAllIterable.

@Override
public void containsAllIterable() {
    MutableBooleanCollection emptyCollection1 = this.newWith();
    Assert.assertTrue(emptyCollection1.containsAll(new BooleanArrayList()));
    Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(false)));
    MutableBooleanCollection collection = this.classUnderTest();
    Assert.assertTrue(collection.containsAll(new BooleanArrayList()));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false, true)));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

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