@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(2, result.sizeDistinct());
   Assert.assertEquals(4, result.occurrencesOf(true));
   Assert.assertEquals(6, result.occurrencesOf(false));
 }
  @Test
  public void toBag() {
    MutableObjectBooleanMap<String> map1 =
        this.newWithKeysValues("1", false, null, true, "2", false);
    MutableObjectBooleanMap<String> map0 =
        this.newWithKeysValues("1", false, null, true, "2", true);
    MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
    MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);

    Assert.assertEquals(BooleanHashBag.newBagWith(false, false, true), map1.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false, true, true), map0.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(true), map2.toBag());
    Assert.assertEquals(BooleanHashBag.newBagWith(false), map3.toBag());
  }
 @Override
 @Test
 public void collectBoolean() {
   MutableBag<Integer> integers = UnmodifiableBag.of(HashBag.newBagWith(0, 1, 2, 2));
   Assert.assertEquals(
       BooleanHashBag.newBagWith(false, true, true, true),
       integers.collectBoolean(PrimitiveFunctions.integerIsPositive()));
 }
  @Test
  public void reject() {
    Assert.assertEquals(
        BooleanHashBag.newBagWith(false), this.map.reject(BooleanPredicates.isTrue()).toBag());
    Assert.assertEquals(
        BooleanHashBag.newBagWith(true, true),
        this.map.reject(BooleanPredicates.isFalse()).toBag());
    Assert.assertEquals(
        new BooleanHashBag(),
        this.map
            .reject(BooleanPredicates.or(BooleanPredicates.isTrue(), BooleanPredicates.isFalse()))
            .toBag());
    Assert.assertEquals(
        BooleanHashBag.newBagWith(true, true, false),
        this.map
            .reject(BooleanPredicates.and(BooleanPredicates.isTrue(), BooleanPredicates.isFalse()))
            .toBag());

    Assert.assertEquals(
        this.newWithKeysValues("1", true, "2", false),
        this.map.reject(
            new ObjectBooleanPredicate<String>() {
              public boolean accept(String object, boolean value) {
                return (Integer.parseInt(object) & 1) == 0 && value;
              }
            }));
    Assert.assertEquals(
        this.newWithKeysValues("0", true, "1", true),
        this.map.reject(
            new ObjectBooleanPredicate<String>() {
              public boolean accept(String object, boolean value) {
                return (Integer.parseInt(object) & 1) == 0 && !value;
              }
            }));
    Assert.assertEquals(
        this.newWithKeysValues("0", true, "1", true, "2", false),
        this.map.reject(
            new ObjectBooleanPredicate<String>() {
              public boolean accept(String object, boolean value) {
                return (Integer.parseInt(object) & 1) != 0 && !value;
              }
            }));
  }
 public MutableBooleanBag toBag() {
   return BooleanHashBag.newBag(this);
 }
 @Test
 public void toBag() {
   Assert.assertEquals(
       BooleanHashBag.newBagWith(true, false, true), this.classUnderTest().toBag());
 }