use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class ImmutableBagTestCase method collectBooleanWithTarget.
@Override
@Test
public void collectBooleanWithTarget() {
super.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(2, result.sizeDistinct());
Assert.assertEquals(4, result.occurrencesOf(true));
Assert.assertEquals(6, result.occurrencesOf(false));
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class MapIterateTest method collectBooleanWithTarget.
@Test
public void collectBooleanWithTarget() {
BooleanHashBag target = new BooleanHashBag();
BooleanHashBag result = MapIterate.collectBoolean(MapIterateTest.newLittleMap(), PrimitiveFunctions.integerIsPositive(), target);
Assert.assertEquals(BooleanHashBag.newBagWith(true, true), result.toBag());
Assert.assertSame("Target sent as parameter was not returned as result", target, result);
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class AbstractObjectBooleanMapTestCase method reject.
@Test
public void reject() {
Assert.assertEquals(BooleanHashBag.newBagWith(false), this.classUnderTest().reject(BooleanPredicates.isTrue()).toBag());
Assert.assertEquals(BooleanHashBag.newBagWith(true, true), this.classUnderTest().reject(BooleanPredicates.isFalse()).toBag());
Assert.assertEquals(new BooleanHashBag(), this.classUnderTest().reject(BooleanPredicates.or(BooleanPredicates.isTrue(), BooleanPredicates.isFalse())).toBag());
Assert.assertEquals(BooleanHashBag.newBagWith(true, true, false), this.classUnderTest().reject(BooleanPredicates.and(BooleanPredicates.isTrue(), BooleanPredicates.isFalse())).toBag());
Assert.assertEquals(this.newWithKeysValues("1", true, "2", false), this.classUnderTest().reject((object, value) -> (Integer.parseInt(object) & 1) == 0 && value));
Assert.assertEquals(this.newWithKeysValues("0", true, "1", true), this.classUnderTest().reject((object, value) -> (Integer.parseInt(object) & 1) == 0 && !value));
Assert.assertEquals(this.newWithKeysValues("0", true, "1", true, "2", false), this.classUnderTest().reject((object, value) -> (Integer.parseInt(object) & 1) != 0 && !value));
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class ImmutableObjectBooleanEmptyMapTest method select.
@Override
@Test
public void select() {
Assert.assertEquals(this.classUnderTest(), this.classUnderTest().select((object, value1) -> true));
Assert.assertEquals(new BooleanHashBag(), this.classUnderTest().select(value -> true).toBag());
}
use of org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag in project eclipse-collections by eclipse.
the class ImmutableObjectBooleanEmptyMapTest method reject.
@Override
@Test
public void reject() {
Assert.assertEquals(this.classUnderTest(), this.classUnderTest().reject((object, value1) -> false));
Assert.assertEquals(new BooleanHashBag(), this.classUnderTest().reject(value -> false).toBag());
}
Aggregations