Search in sources :

Example 11 with MutableBooleanSet

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

the class AbstractImmutableSet method collectBoolean.

@Override
public ImmutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction) {
    MutableBooleanSet result = new BooleanHashSet();
    this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
    return result.toImmutable();
}
Also used : BooleanHashSet(org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet) MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet)

Example 12 with MutableBooleanSet

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

the class AbstractMutableSet method collectBoolean.

@Override
public MutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction) {
    MutableBooleanSet result = new BooleanHashSet();
    this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
    return result;
}
Also used : BooleanHashSet(org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet) MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet)

Example 13 with MutableBooleanSet

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

the class AbstractBooleanSetTestCase method retainAll.

@Override
@Test
public void retainAll() {
    super.retainAll();
    Assert.assertFalse(this.emptySet.retainAll());
    Assert.assertTrue(this.setWithTrueFalse.retainAll(true, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true), this.setWithTrueFalse);
    MutableBooleanSet set = this.newWith(true, false);
    Assert.assertTrue(set.retainAll());
    Assert.assertEquals(BooleanHashSet.newSetWith(), set);
    MutableBooleanSet sett = this.newWith(true, false);
    Assert.assertTrue(sett.retainAll(false, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(false), sett);
    MutableBooleanSet sett2 = this.newWith(true);
    Assert.assertTrue(sett2.retainAll(false, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), sett2);
    Assert.assertTrue(this.setWithTrue.retainAll(false, false));
    Assert.assertFalse(this.setWithTrue.retainAll(true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithTrue);
    MutableBooleanSet sett3 = this.newWith(false);
    Assert.assertFalse(sett3.retainAll(false, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(false), sett3);
    Assert.assertTrue(this.setWithFalse.retainAll(true, true));
    Assert.assertFalse(this.setWithFalse.retainAll(true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithFalse);
    Assert.assertFalse(this.emptySet.retainAll(true, true));
    Assert.assertFalse(this.emptySet.retainAll(true, false));
    Assert.assertFalse(this.emptySet.retainAll(false, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.emptySet);
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 14 with MutableBooleanSet

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

the class AbstractBooleanSetTestCase method removeAll_iterable.

@Override
@Test
public void removeAll_iterable() {
    super.removeAll_iterable();
    Assert.assertFalse(this.emptySet.removeAll(new BooleanArrayList()));
    Assert.assertFalse(this.setWithFalse.removeAll(new BooleanArrayList()));
    Assert.assertFalse(this.setWithTrue.removeAll(new BooleanArrayList()));
    Assert.assertFalse(this.setWithTrueFalse.removeAll(new BooleanArrayList()));
    Assert.assertTrue(this.setWithTrueFalse.removeAll(BooleanArrayList.newListWith(true, true)));
    Assert.assertEquals(BooleanHashSet.newSetWith(false), this.setWithTrueFalse);
    MutableBooleanSet set = this.newWith(true, false);
    Assert.assertTrue(set.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), set);
    MutableBooleanSet sett = this.newWith(true, false);
    Assert.assertTrue(sett.removeAll(BooleanArrayList.newListWith(false, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(true), sett);
    Assert.assertFalse(this.setWithTrue.removeAll(BooleanArrayList.newListWith(false, false)));
    MutableBooleanSet sett2 = this.newWith(true);
    Assert.assertTrue(sett2.removeAll(BooleanArrayList.newListWith(true, true)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), sett2);
    Assert.assertTrue(this.setWithTrue.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithTrue);
    Assert.assertFalse(this.setWithFalse.removeAll(true, true));
    MutableBooleanSet sett3 = this.newWith(false);
    Assert.assertTrue(sett3.removeAll(BooleanArrayList.newListWith(false, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), sett3);
    Assert.assertTrue(this.setWithFalse.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithFalse);
    Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(true, true)));
    Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(false, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.emptySet);
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 15 with MutableBooleanSet

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

the class UnmodifiableBooleanSetTest method asUnmodifiable.

@Override
@Test
public void asUnmodifiable() {
    super.asUnmodifiable();
    MutableBooleanSet set = this.classUnderTest();
    Assert.assertSame(set, set.asUnmodifiable());
    Assert.assertEquals(set, set.asUnmodifiable());
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Aggregations

MutableBooleanSet (org.eclipse.collections.api.set.primitive.MutableBooleanSet)16 Test (org.junit.Test)11 BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)5 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)3 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)2