use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class BooleanBagsTest method immutables.
@Test
public void immutables() {
ImmutableBooleanBagFactory bagFactory = BooleanBags.immutable;
Assert.assertEquals(new BooleanHashBag(), bagFactory.of());
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of());
Assert.assertEquals(BooleanHashBag.newBagWith(true), bagFactory.of(true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false), bagFactory.of(true, false));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true), bagFactory.of(true, false, true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false), bagFactory.of(true, false, true, false));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true), bagFactory.of(true, false, true, false, true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true, false), bagFactory.of(true, false, true, false, true, false));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true, false));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true, false, true), bagFactory.of(true, false, true, false, true, false, true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true, false, true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true, false, true, true), bagFactory.of(true, false, true, false, true, false, true, true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true, false, true, true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true, false, true, true, true), bagFactory.of(true, false, true, false, true, false, true, true, true));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true, false, true, true, true));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true, false, true, true, true, false), bagFactory.of(true, false, true, false, true, false, true, true, true, false));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.of(true, false, true, false, true, false, true, true, true, false));
Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true), bagFactory.ofAll(BooleanHashBag.newBagWith(true, false, true)));
Verify.assertInstanceOf(ImmutableBooleanBag.class, bagFactory.ofAll(BooleanHashBag.newBagWith(true, false, true)));
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class ImmutableEmptyBagTest method collectBooleanWithTarget.
@Override
@Test
public void collectBooleanWithTarget() {
BooleanHashBag target = new BooleanHashBag();
BooleanHashBag result = this.newBag().collectBoolean("4"::equals, target);
Assert.assertSame("Target sent as parameter not returned", target, result);
Assert.assertEquals(0, result.sizeDistinct());
Assert.assertEquals(0, result.occurrencesOf(true));
Assert.assertEquals(0, result.occurrencesOf(false));
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class ImmutableSingletonBagTest method collectBooleanWithTarget.
@Override
@Test
public void collectBooleanWithTarget() {
BooleanHashBag target = new BooleanHashBag();
BooleanHashBag result = this.newBag().collectBoolean("4"::equals, target);
Assert.assertSame("Target sent as parameter not returned", target, result);
Assert.assertEquals(1, result.sizeDistinct());
Assert.assertEquals(0, result.occurrencesOf(true));
Assert.assertEquals(1, result.occurrencesOf(false));
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanBagTestCase method booleanIterator.
@Override
@Test
public void booleanIterator() {
BooleanHashBag bag = BooleanHashBag.newBagWith();
BooleanIterator iterator = this.classUnderTest().booleanIterator();
for (int i = 0; i < this.classUnderTest().size(); i++) {
Assert.assertTrue(iterator.hasNext());
bag.add(iterator.next());
}
Assert.assertEquals(bag, this.classUnderTest());
Assert.assertFalse(iterator.hasNext());
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectBooleanWithBagTarget.
@Test
public void collectBooleanWithBagTarget() {
BooleanHashBag target = new BooleanHashBag();
BooleanHashBag result = this.newWith(1, 0).collectBoolean(PrimitiveFunctions.integerIsPositive(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(BooleanHashBag.newBagWith(true, false), result);
}
Aggregations