Search in sources :

Example 1 with ImmutableBooleanSet

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

the class ImmutableBooleanEmptySet 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) ImmutableEmptyBooleanIterator(org.eclipse.collections.impl.iterator.ImmutableEmptyBooleanIterator)

Example 2 with ImmutableBooleanSet

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

the class ImmutableTrueFalseSet 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 3 with ImmutableBooleanSet

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

the class ImmutableTrueSet 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 4 with ImmutableBooleanSet

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

the class BooleanSetsTest method newSetWithSet.

@Test
public void newSetWithSet() {
    ImmutableBooleanSet set = BooleanSets.immutable.with();
    BooleanHashSet booleanHashSet = BooleanHashSet.newSetWith(true);
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.toImmutable());
    Assert.assertEquals(set = set.newWith(false), booleanHashSet.with(false).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
    Assert.assertEquals(set = set.newWith(false), booleanHashSet.with(false).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
    Assert.assertEquals(set = set.newWith(false), booleanHashSet.with(false).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
    Assert.assertEquals(set = set.newWith(false), booleanHashSet.with(false).toImmutable());
    Assert.assertEquals(set = set.newWith(true), booleanHashSet.with(true).toImmutable());
}
Also used : ImmutableBooleanSet(org.eclipse.collections.api.set.primitive.ImmutableBooleanSet) BooleanHashSet(org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet) Test(org.junit.Test)

Example 5 with ImmutableBooleanSet

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

the class ImmutableBooleanSetFactoryImplTest method ofAll.

@Test
public void ofAll() {
    ImmutableBooleanSet set = BooleanSets.immutable.of(true, false);
    Assert.assertEquals(BooleanHashSet.newSet(set).toImmutable(), BooleanSets.immutable.ofAll(set));
    Assert.assertEquals(BooleanHashSet.newSet(BooleanArrayList.newListWith(true, false, true)).toImmutable(), BooleanSets.immutable.ofAll(BooleanArrayList.newListWith(true, false)));
}
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