Search in sources :

Example 6 with BooleanHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet 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 7 with BooleanHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet 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 8 with BooleanHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet in project eclipse-collections by eclipse.

the class SetAdapter method collectBoolean.

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

Example 9 with BooleanHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet in project eclipse-collections by eclipse.

the class BooleanSetsTest method immutables.

@Test
public void immutables() {
    ImmutableBooleanSetFactory setFactory = BooleanSets.immutable;
    Assert.assertEquals(new BooleanHashSet(), setFactory.with());
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with());
    Assert.assertEquals(BooleanHashSet.newSetWith(true), setFactory.with(true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), setFactory.with(true, false));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true), setFactory.with(true, false, true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false), setFactory.with(true, false, true, false));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true), setFactory.with(true, false, true, false, true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true, false), setFactory.with(true, false, true, false, true, false));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true, false, true), setFactory.with(true, false, true, false, true, false, true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true, false, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true, false, true, true), setFactory.with(true, false, true, false, true, false, true, true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true, false, true, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true, false, true, true, true), setFactory.with(true, false, true, false, true, false, true, true, true));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true, false, true, true, true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true, false, true, false, true, true, true, false), setFactory.with(true, false, true, false, true, false, true, true, true, false));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.with(true, false, true, false, true, false, true, true, true, false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true), setFactory.withAll(BooleanHashSet.newSetWith(true, false, true)));
    Verify.assertInstanceOf(ImmutableBooleanSet.class, setFactory.withAll(BooleanHashSet.newSetWith(true, false, true)));
}
Also used : ImmutableBooleanSetFactory(org.eclipse.collections.api.factory.set.primitive.ImmutableBooleanSetFactory) BooleanHashSet(org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet) Test(org.junit.Test)

Example 10 with BooleanHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet in project eclipse-collections by eclipse.

the class BooleanSetsTest method newSetWithWithSet.

@Test
public void newSetWithWithSet() {
    Assert.assertEquals(new BooleanHashSet(), BooleanSets.immutable.withAll(new BooleanHashSet()));
    Assert.assertEquals(BooleanHashSet.newSetWith(true), BooleanSets.immutable.withAll(BooleanHashSet.newSetWith(true)));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), BooleanSets.immutable.withAll(BooleanHashSet.newSetWith(true, false)));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false, true), BooleanSets.immutable.withAll(BooleanHashSet.newSetWith(true, false, true)));
}
Also used : BooleanHashSet(org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet) Test(org.junit.Test)

Aggregations

BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)12 MutableBooleanSet (org.eclipse.collections.api.set.primitive.MutableBooleanSet)5 Test (org.junit.Test)4 ImmutableBooleanSetFactory (org.eclipse.collections.api.factory.set.primitive.ImmutableBooleanSetFactory)1 ImmutableBooleanSet (org.eclipse.collections.api.set.primitive.ImmutableBooleanSet)1 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)1