Search in sources :

Example 6 with ImmutableBooleanSet

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

the class ImmutableFalseSet method newWithAll.

@Override
public ImmutableBooleanSet newWithAll(BooleanIterable elements) {
    ImmutableBooleanSet result = this;
    BooleanIterator booleanIterator = elements.booleanIterator();
    while (booleanIterator.hasNext()) {
        result = result.newWith(booleanIterator.next());
    }
    return result;
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) BooleanIterator(org.eclipse.collections.api.iterator.BooleanIterator)

Example 7 with ImmutableBooleanSet

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

the class ImmutableTrueFalseSet method newWithoutAll.

@Override
public ImmutableBooleanSet newWithoutAll(BooleanIterable elements) {
    ImmutableBooleanSet result = this;
    BooleanIterator booleanIterator = elements.booleanIterator();
    while (booleanIterator.hasNext()) {
        result = result.newWithout(booleanIterator.next());
    }
    return result;
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) BooleanIterator(org.eclipse.collections.api.iterator.BooleanIterator)

Example 8 with ImmutableBooleanSet

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

the class ImmutableBooleanHashSetTest method newCollectionWith.

@Override
@Test
public void newCollectionWith() {
    ImmutableBooleanSet set = this.classUnderTest();
    Verify.assertSize(2, set);
    Assert.assertTrue(set.containsAll(true, false, true));
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) Test(org.junit.Test)

Example 9 with ImmutableBooleanSet

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

the class AbstractImmutableEmptySetTestCase method collectBoolean.

@Override
@Test
public void collectBoolean() {
    ImmutableSet<Integer> integers = this.classUnderTest();
    ImmutableBooleanSet actual = integers.collectBoolean(PrimitiveFunctions.integerIsPositive());
    Verify.assertEmpty(actual);
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) Test(org.junit.Test)

Example 10 with ImmutableBooleanSet

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

the class BooleanSetsTest method newSetWithArray.

@SuppressWarnings("RedundantArrayCreation")
@Test
public void newSetWithArray() {
    ImmutableBooleanSet set = BooleanSets.immutable.with();
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true }));
    Assert.assertEquals(set = set.newWith(false), BooleanSets.immutable.with(new boolean[] { true, false }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true }));
    Assert.assertEquals(set = set.newWith(false), BooleanSets.immutable.with(new boolean[] { true, false, true, false }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true }));
    Assert.assertEquals(set = set.newWith(false), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false, true }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false, true, true }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false, true, true, true }));
    Assert.assertEquals(set = set.newWith(false), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false, true, true, true, false }));
    Assert.assertEquals(set = set.newWith(true), BooleanSets.immutable.with(new boolean[] { true, false, true, false, true, false, true, true, true, false, true }));
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) Test(org.junit.Test)

Aggregations

ImmutableBooleanSet (org.eclipse.collections.api.set.primitive.ImmutableBooleanSet)11 Test (org.junit.Test)6 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)5 ImmutableEmptyBooleanIterator (org.eclipse.collections.impl.iterator.ImmutableEmptyBooleanIterator)1 BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)1