Search in sources :

Example 11 with BooleanHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.

the class AbstractMutableMap method collectBoolean.

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

Example 12 with BooleanHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.

the class AbstractBooleanSetTestCase method toBag.

@Override
@Test
public void toBag() {
    Assert.assertEquals(new BooleanHashBag(), this.emptySet.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false), this.setWithFalse.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(true), this.setWithTrue.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false, true), this.setWithTrueFalse.toBag());
}
Also used : BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) Test(org.junit.Test)

Example 13 with BooleanHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.

the class ImmutableBooleanHashSetTest method toBag.

@Override
@Test
public void toBag() {
    Assert.assertEquals(new BooleanHashBag(), this.emptySet.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false), this.falseSet.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(true), this.trueSet.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false, true), this.trueFalseSet.toBag());
}
Also used : BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) Test(org.junit.Test)

Example 14 with BooleanHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.

the class BooleanBagsTest method newBagWithBag.

@Test
public void newBagWithBag() {
    ImmutableBooleanBag bag = BooleanBags.immutable.of();
    BooleanHashBag booleanHashBag = BooleanHashBag.newBagWith(true);
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.toImmutable());
    Assert.assertEquals(bag = bag.newWith(false), booleanHashBag.with(false).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
    Assert.assertEquals(bag = bag.newWith(false), booleanHashBag.with(false).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
    Assert.assertEquals(bag = bag.newWith(false), booleanHashBag.with(false).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
    Assert.assertEquals(bag = bag.newWith(false), booleanHashBag.with(false).toImmutable());
    Assert.assertEquals(bag = bag.newWith(true), booleanHashBag.with(true).toImmutable());
}
Also used : BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) Test(org.junit.Test)

Example 15 with BooleanHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.

the class BooleanBagsTest method newBagWithWithBag.

@Test
public void newBagWithWithBag() {
    Assert.assertEquals(new BooleanHashBag(), BooleanBags.immutable.ofAll(new BooleanHashBag()));
    Assert.assertEquals(BooleanHashBag.newBagWith(true), BooleanBags.immutable.ofAll(BooleanHashBag.newBagWith(true)));
    Assert.assertEquals(BooleanHashBag.newBagWith(true, false), BooleanBags.immutable.ofAll(BooleanHashBag.newBagWith(true, false)));
    Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true), BooleanBags.immutable.ofAll(BooleanHashBag.newBagWith(true, false, true)));
}
Also used : BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) Test(org.junit.Test)

Aggregations

BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)23 Test (org.junit.Test)21 NoSuchElementException (java.util.NoSuchElementException)8 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)8 Assert (org.junit.Assert)8 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)7 FastList (org.eclipse.collections.impl.list.mutable.FastList)7 Verify (org.eclipse.collections.impl.test.Verify)7 ImmutableObjectBooleanMap (org.eclipse.collections.api.map.primitive.ImmutableObjectBooleanMap)6 ObjectBooleanMap (org.eclipse.collections.api.map.primitive.ObjectBooleanMap)6 BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)6 BooleanPredicates (org.eclipse.collections.impl.block.factory.primitive.BooleanPredicates)4 UnifiedMap (org.eclipse.collections.impl.map.mutable.UnifiedMap)4 ObjectBooleanHashMap (org.eclipse.collections.impl.map.mutable.primitive.ObjectBooleanHashMap)3 Arrays (java.util.Arrays)2 MutableBooleanBag (org.eclipse.collections.api.bag.primitive.MutableBooleanBag)2 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 Iterator (java.util.Iterator)1 List (java.util.List)1