@Test
  public void forEachKeyValue() {
    MutableObjectBooleanMap<Integer> map01 = this.newWithKeysValues(0, true, 1, false);
    final String[] sumValue01 = new String[1];
    sumValue01[0] = "";
    final int[] sumKey01 = new int[1];
    map01.forEachKeyValue(
        new ObjectBooleanProcedure<Integer>() {
          public void value(Integer eachKey, boolean eachValue) {
            sumKey01[0] += eachKey;
            sumValue01[0] += eachValue;
          }
        });
    Assert.assertEquals(1, sumKey01[0]);
    Assert.assertTrue("truefalse".equals(sumValue01[0]) || "falsetrue".equals(sumValue01[0]));

    MutableObjectBooleanMap<Integer> map = this.newWithKeysValues(3, true, null, false);
    final String[] sumKey = new String[1];
    sumKey[0] = "";
    final String[] sumValue = new String[1];
    sumValue[0] = "";
    map.forEachKeyValue(
        new ObjectBooleanProcedure<Integer>() {
          public void value(Integer eachKey, boolean eachValue) {
            sumKey[0] += String.valueOf(eachKey);
            sumValue[0] += eachValue;
          }
        });
    Assert.assertTrue(sumKey[0], "3null".equals(sumKey[0]) || "null3".equals(sumKey[0]));
    Assert.assertTrue("truefalse".equals(sumValue[0]) || "falsetrue".equals(sumValue[0]));
  }
 @Test
 public void withKeysValues() {
   MutableObjectBooleanMap<Integer> emptyMap = this.getEmptyMap();
   MutableObjectBooleanMap<Integer> hashMap = emptyMap.withKeyValue(1, true);
   Assert.assertEquals(this.newWithKeysValues(1, true), hashMap);
   Assert.assertSame(emptyMap, hashMap);
 }
 @Override
 public void size() {
   super.size();
   MutableObjectBooleanMap<Integer> hashMap1 = this.newWithKeysValues(1, true, 0, false);
   Verify.assertSize(2, hashMap1);
   hashMap1.removeKey(1);
   Verify.assertSize(1, hashMap1);
   hashMap1.removeKey(0);
   Verify.assertSize(0, hashMap1);
 }
  @Override
  public void getIfAbsent() {
    super.getIfAbsent();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.removeKey("0");
    Assert.assertTrue(map1.getIfAbsent("0", true));
    Assert.assertFalse(map1.getIfAbsent("0", false));

    map1.put("0", false);
    Assert.assertFalse(map1.getIfAbsent("0", true));

    map1.put("5", true);
    Assert.assertTrue(map1.getIfAbsent("5", false));

    map1.put(null, false);
    Assert.assertFalse(map1.getIfAbsent(null, true));
  }
  @Test
  public void size() {
    Verify.assertSize(0, this.getEmptyMap());
    Verify.assertSize(1, this.getEmptyMap().withKeyValue(0, false));
    Verify.assertSize(1, this.getEmptyMap().withKeyValue(1, true));
    Verify.assertSize(1, this.getEmptyMap().withKeyValue(null, false));

    MutableObjectBooleanMap<Integer> hashMap1 = this.newWithKeysValues(1, true, 0, false);
    Verify.assertSize(2, hashMap1);
    hashMap1.removeKey(1);
    Verify.assertSize(1, hashMap1);
    hashMap1.removeKey(0);
    Verify.assertSize(0, hashMap1);

    Verify.assertSize(2, this.newWithKeysValues(1, false, 5, false));
    Verify.assertSize(2, this.newWithKeysValues(0, true, 5, true));
  }
  @Test
  public void toList() {
    MutableObjectBooleanMap<String> map1 = this.newWithKeysValues(null, true, "1", false);
    MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
    MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);

    Assert.assertTrue(
        map1.toList().toString(),
        BooleanArrayList.newListWith(true, false).equals(map1.toList())
            || BooleanArrayList.newListWith(false, true).equals(map1.toList()));
    Assert.assertEquals(BooleanArrayList.newListWith(true), map2.toList());
    Assert.assertEquals(BooleanArrayList.newListWith(false), map3.toList());
  }
  @Test
  public void forEach() {
    MutableObjectBooleanMap<Integer> map01 = this.newWithKeysValues(0, true, 1, false);
    final String[] sum01 = new String[1];
    sum01[0] = "";
    map01.forEach(
        new BooleanProcedure() {
          public void value(boolean each) {
            sum01[0] += String.valueOf(each);
          }
        });
    Assert.assertTrue("truefalse".equals(sum01[0]) || "falsetrue".equals(sum01[0]));

    MutableObjectBooleanMap<Integer> map = this.newWithKeysValues(3, true, 4, true);
    final String[] sum = new String[1];
    sum[0] = "";
    map.forEach(
        new BooleanProcedure() {
          public void value(boolean each) {
            sum[0] += String.valueOf(each);
          }
        });
    Assert.assertEquals("truetrue", sum[0]);

    MutableObjectBooleanMap<Integer> map1 = this.newWithKeysValues(3, false, null, true);
    final String[] sum1 = new String[1];
    sum1[0] = "";
    map1.forEach(
        new BooleanProcedure() {
          public void value(boolean each) {
            sum1[0] += String.valueOf(each);
          }
        });
    Assert.assertTrue("truefalse".equals(sum1[0]) || "falsetrue".equals(sum1[0]));
  }
  @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());
  }
  @Test
  public void appendString() {
    Appendable appendable = new StringBuilder();
    this.getEmptyMap().appendString(appendable);
    Assert.assertEquals("", appendable.toString());

    Appendable appendable0 = new StringBuilder();
    this.newWithKeysValues(0, true).appendString(appendable0);
    Assert.assertEquals("0=true", appendable0.toString());

    Appendable appendable1 = new StringBuilder();
    this.newWithKeysValues(1, false).appendString(appendable1);
    Assert.assertEquals("1=false", appendable1.toString());

    Appendable appendable2 = new StringBuilder();
    this.newWithKeysValues(null, false).appendString(appendable2);
    Assert.assertEquals("null=false", appendable2.toString());

    Appendable appendable3 = new StringBuilder();
    MutableObjectBooleanMap<Integer> map1 = this.newWithKeysValues(0, true, 1, false);
    map1.appendString(appendable3);
    Assert.assertTrue(
        appendable3.toString(),
        "0=true, 1=false".equals(appendable3.toString())
            || "1=false, 0=true".equals(appendable3.toString()));

    Appendable appendable4 = new StringBuilder();
    map1.appendString(appendable4, "/");
    Assert.assertTrue(
        appendable4.toString(),
        "0=true/1=false".equals(appendable4.toString())
            || "1=false/0=true".equals(appendable4.toString()));

    Appendable appendable5 = new StringBuilder();
    map1.appendString(appendable5, "[", "/", "]");
    Assert.assertTrue(
        appendable5.toString(),
        "[0=true/1=false]".equals(appendable5.toString())
            || "[1=false/0=true]".equals(appendable5.toString()));
  }
  @Test
  public void removeKey() {
    MutableObjectBooleanMap<String> map0 = this.newWithKeysValues("0", true, "1", false);
    map0.removeKey("1");
    Assert.assertEquals(this.newWithKeysValues("0", true), map0);
    map0.removeKey("0");
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), map0);

    MutableObjectBooleanMap<String> map1 = this.newWithKeysValues("0", false, "1", true);
    map1.removeKey("0");
    Assert.assertEquals(this.newWithKeysValues("1", true), map1);
    map1.removeKey("1");
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), map1);

    this.map.removeKey("5");
    Assert.assertEquals(this.newWithKeysValues("0", true, "1", true, "2", false), this.map);
    this.map.removeKey("0");
    Assert.assertEquals(this.newWithKeysValues("1", true, "2", false), this.map);
    this.map.removeKey("1");
    Assert.assertEquals(this.newWithKeysValues("2", false), this.map);
    this.map.removeKey("2");
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), this.map);
    this.map.removeKey("0");
    this.map.removeKey("1");
    this.map.removeKey("2");
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), this.map);
    Verify.assertEmpty(this.map);

    this.map.put(null, true);
    Assert.assertTrue(this.map.get(null));
    this.map.removeKey(null);
    Assert.assertFalse(this.map.get(null));
  }
  @Override
  public void getOrThrow() {
    super.getOrThrow();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.removeKey("0");
    Verify.assertThrows(
        IllegalStateException.class,
        () -> {
          map1.getOrThrow("0");
        });
    map1.put("0", false);
    Assert.assertFalse(map1.getOrThrow("0"));

    map1.put("5", true);
    Assert.assertTrue(map1.getOrThrow("5"));

    map1.put(null, false);
    Assert.assertFalse(map1.getOrThrow(null));
  }
  @Test
  public void toArray() {
    MutableObjectBooleanMap<String> map1 = this.newWithKeysValues(null, true, "1", false);
    MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
    MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);

    Assert.assertTrue(
        Arrays.equals(new boolean[] {true, false}, map1.toArray())
            || Arrays.equals(new boolean[] {false, true}, map1.toArray()));
    Assert.assertTrue(Arrays.equals(new boolean[] {true}, map2.toArray()));
    Assert.assertTrue(Arrays.equals(new boolean[] {false}, map3.toArray()));
  }
  @Test
  public void forEachKey() {
    MutableObjectBooleanMap<Integer> map01 = this.newWithKeysValues(0, true, 1, false);
    final int[] sum01 = new int[1];
    map01.forEachKey(
        new Procedure<Integer>() {
          public void value(Integer each) {
            sum01[0] += each;
          }
        });
    Assert.assertEquals(1, sum01[0]);

    MutableObjectBooleanMap<Integer> map = this.newWithKeysValues(3, false, null, true);
    final String[] sum = new String[1];
    sum[0] = "";
    map.forEachKey(
        new Procedure<Integer>() {
          public void value(Integer each) {
            sum[0] += String.valueOf(each);
          }
        });
    Assert.assertTrue("3null".equals(sum[0]) || "null3".equals(sum[0]));
  }
  @Test
  public void clear() {
    MutableObjectBooleanMap<String> hashMap = this.getEmptyMap();
    hashMap.put("0", true);
    hashMap.clear();
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), hashMap);

    hashMap.put("1", false);
    hashMap.clear();
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), hashMap);

    hashMap.put(null, true);
    hashMap.clear();
    Assert.assertEquals(ObjectBooleanHashMap.newMap(), hashMap);
  }
 @Test
 public void withoutKey() {
   MutableObjectBooleanMap<Integer> hashMap =
       this.newWithKeysValues(1, true, 2, true, 3, false, 4, false);
   MutableObjectBooleanMap<Integer> actual = hashMap.withoutKey(5);
   Assert.assertSame(hashMap, actual);
   Assert.assertEquals(this.newWithKeysValues(1, true, 2, true, 3, false, 4, false), actual);
   Assert.assertEquals(this.newWithKeysValues(1, true, 2, true, 3, false), hashMap.withoutKey(4));
   Assert.assertEquals(this.newWithKeysValues(1, true, 2, true), hashMap.withoutKey(3));
   Assert.assertEquals(this.newWithKeysValues(1, true), hashMap.withoutKey(2));
   Assert.assertEquals(ObjectBooleanHashMap.newMap(), hashMap.withoutKey(1));
   Assert.assertEquals(ObjectBooleanHashMap.newMap(), hashMap.withoutKey(1));
 }
 @Test
 public void collect() {
   MutableObjectBooleanMap<String> map1 = this.newWithKeysValues("0", true, "1", false);
   MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
   MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);
   BooleanToObjectFunction<String> stringValueOf =
       new BooleanToObjectFunction<String>() {
         public String valueOf(boolean booleanParameter) {
           return String.valueOf(booleanParameter);
         }
       };
   Assert.assertTrue(
       FastList.newListWith("true", "false").equals(map1.collect(stringValueOf))
           || FastList.newListWith("false", "true").equals(map1.collect(stringValueOf)));
   Assert.assertEquals(FastList.newListWith("true"), map2.collect(stringValueOf));
   Assert.assertEquals(FastList.newListWith("false"), map3.collect(stringValueOf));
 }
  @Test
  public void makeString() {
    Assert.assertEquals("", this.<String>getEmptyMap().makeString());
    Assert.assertEquals("0=true", this.newWithKeysValues(0, true).makeString());
    Assert.assertEquals("1=false", this.newWithKeysValues(1, false).makeString());
    Assert.assertEquals("null=true", this.newWithKeysValues(null, true).makeString());

    MutableObjectBooleanMap<Integer> map2 = this.newWithKeysValues(1, true, 32, false);
    Assert.assertTrue(
        map2.makeString("[", "/", "]"),
        "[1=true/32=false]".equals(map2.makeString("[", "/", "]"))
            || "[32=false/1=true]".equals(map2.makeString("[", "/", "]")));

    Assert.assertTrue(
        map2.makeString("/"),
        "1=true/32=false".equals(map2.makeString("/"))
            || "32=false/1=true".equals(map2.makeString("/")));
  }
 @Test
 public void withoutAllKeys() {
   MutableObjectBooleanMap<Integer> hashMap =
       this.newWithKeysValues(1, true, 2, true, 3, false, 4, false);
   MutableObjectBooleanMap<Integer> actual = hashMap.withoutAllKeys(FastList.newListWith(5, 6, 7));
   Assert.assertSame(hashMap, actual);
   Assert.assertEquals(this.newWithKeysValues(1, true, 2, true, 3, false, 4, false), actual);
   Assert.assertEquals(
       this.newWithKeysValues(1, true, 2, true),
       hashMap.withoutAllKeys(FastList.newListWith(5, 4, 3)));
   Assert.assertEquals(
       this.newWithKeysValues(1, true), hashMap.withoutAllKeys(FastList.newListWith(2)));
   Assert.assertEquals(
       ObjectBooleanHashMap.newMap(), hashMap.withoutAllKeys(FastList.newListWith(1)));
   Assert.assertEquals(
       ObjectBooleanHashMap.newMap(), hashMap.withoutAllKeys(FastList.newListWith(5, 6)));
 }
  @Test
  public void iterator() {
    MutableObjectBooleanMap<String> map1 =
        this.newWithKeysValues(null, true, "GSCollections", false);
    MutableObjectBooleanMap<String> map2 = this.newWithKeysValues("0", true);
    MutableObjectBooleanMap<String> map3 = this.newWithKeysValues("0", false);

    final BooleanIterator iterator1 = map1.booleanIterator();
    Assert.assertTrue(iterator1.hasNext());
    boolean first = iterator1.next();
    Assert.assertTrue(iterator1.hasNext());
    boolean second = iterator1.next();
    Assert.assertEquals(first, !second);
    Assert.assertFalse(iterator1.hasNext());
    Verify.assertThrows(
        NoSuchElementException.class,
        new Runnable() {
          public void run() {
            iterator1.next();
          }
        });

    final BooleanIterator iterator2 = map2.booleanIterator();
    Assert.assertTrue(iterator2.hasNext());
    Assert.assertTrue(iterator2.next());
    Assert.assertFalse(iterator2.hasNext());
    Verify.assertThrows(
        NoSuchElementException.class,
        new Runnable() {
          public void run() {
            iterator2.next();
          }
        });

    final BooleanIterator iterator3 = map3.booleanIterator();
    Assert.assertTrue(iterator3.hasNext());
    Assert.assertFalse(iterator3.next());
    Assert.assertFalse(iterator3.hasNext());
    Verify.assertThrows(
        NoSuchElementException.class,
        new Runnable() {
          public void run() {
            iterator3.next();
          }
        });
  }
  @Override
  public void containsKey() {
    super.containsKey();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.removeKey("0");
    Assert.assertFalse(map1.containsKey("0"));
    Assert.assertFalse(map1.get("0"));
    map1.removeKey("0");
    Assert.assertFalse(map1.containsKey("0"));
    Assert.assertFalse(map1.get("0"));

    map1.removeKey("1");
    Assert.assertFalse(map1.containsKey("1"));
    Assert.assertFalse(map1.get("1"));

    map1.removeKey("2");
    Assert.assertFalse(map1.containsKey("2"));
    Assert.assertFalse(map1.get("2"));

    map1.removeKey("3");
    Assert.assertFalse(map1.containsKey("3"));
    Assert.assertFalse(map1.get("3"));
    map1.put(null, true);
    Assert.assertTrue(map1.containsKey(null));
    map1.removeKey(null);
    Assert.assertFalse(map1.containsKey(null));
  }
  @Override
  public void contains() {
    super.contains();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.clear();

    map1.put("5", true);
    Assert.assertTrue(map1.contains(true));

    map1.put(null, false);
    Assert.assertTrue(map1.contains(false));

    map1.removeKey("5");
    Assert.assertFalse(map1.contains(true));
    Assert.assertTrue(map1.contains(false));

    map1.removeKey(null);
    Assert.assertFalse(map1.contains(false));
  }
  @Override
  public void containsAllIterable() {
    super.containsAllIterable();
    MutableObjectBooleanMap<String> map1 = this.classUnderTest();
    map1.clear();

    map1.put("5", true);
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(false, false)));

    map1.put(null, false);
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(true, false)));

    map1.removeKey("5");
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(map1.containsAll(BooleanArrayList.newListWith(false, false)));

    map1.removeKey(null);
    Assert.assertFalse(map1.containsAll(BooleanArrayList.newListWith(false, true)));
  }
  @Test
  public void getIfAbsentPut_Function() {
    MutableObjectBooleanMap<Integer> map1 = this.getEmptyMap();
    Assert.assertTrue(map1.getIfAbsentPut(0, () -> true));
    BooleanFunction0 factoryThrows =
        () -> {
          throw new AssertionError();
        };
    Assert.assertTrue(map1.getIfAbsentPut(0, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true), map1);
    Assert.assertTrue(map1.getIfAbsentPut(1, () -> true));
    Assert.assertTrue(map1.getIfAbsentPut(1, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true, 1, true), map1);

    MutableObjectBooleanMap<Integer> map2 = this.getEmptyMap();
    Assert.assertFalse(map2.getIfAbsentPut(1, () -> false));
    Assert.assertFalse(map2.getIfAbsentPut(1, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(1, false), map2);
    Assert.assertFalse(map2.getIfAbsentPut(0, () -> false));
    Assert.assertFalse(map2.getIfAbsentPut(0, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, false, 1, false), map2);

    MutableObjectBooleanMap<Integer> map3 = this.getEmptyMap();
    Assert.assertTrue(map3.getIfAbsentPut(null, () -> true));
    Assert.assertTrue(map3.getIfAbsentPut(null, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(null, true), map3);
  }
  @Test
  public void putDuplicateWithRemovedSlot() {
    String collision1 = generateCollisions().getFirst();
    String collision2 = generateCollisions().get(1);
    String collision3 = generateCollisions().get(2);
    String collision4 = generateCollisions().get(3);

    MutableObjectBooleanMap<String> hashMap = this.getEmptyMap();
    hashMap.put(collision1, true);
    hashMap.put(collision2, false);
    hashMap.put(collision3, true);
    Assert.assertFalse(hashMap.get(collision2));
    hashMap.removeKey(collision2);
    hashMap.put(collision4, false);
    Assert.assertEquals(
        this.newWithKeysValues(collision1, true, collision3, true, collision4, false), hashMap);

    MutableObjectBooleanMap<String> hashMap1 = this.getEmptyMap();
    hashMap1.put(collision1, false);
    hashMap1.put(collision2, false);
    hashMap1.put(collision3, true);
    Assert.assertFalse(hashMap1.get(collision1));
    hashMap1.removeKey(collision1);
    hashMap1.put(collision4, true);
    Assert.assertEquals(
        this.newWithKeysValues(collision2, false, collision3, true, collision4, true), hashMap1);

    MutableObjectBooleanMap<String> hashMap2 = this.getEmptyMap();
    hashMap2.put(collision1, true);
    hashMap2.put(collision2, true);
    hashMap2.put(collision3, false);
    Assert.assertFalse(hashMap2.get(collision3));
    hashMap2.removeKey(collision3);
    hashMap2.put(collision4, false);
    Assert.assertEquals(
        this.newWithKeysValues(collision1, true, collision2, true, collision4, false), hashMap2);

    MutableObjectBooleanMap<String> hashMap3 = this.getEmptyMap();
    hashMap3.put(collision1, true);
    hashMap3.put(collision2, true);
    hashMap3.put(collision3, false);
    Assert.assertTrue(hashMap3.get(collision2));
    Assert.assertFalse(hashMap3.get(collision3));
    hashMap3.removeKey(collision2);
    hashMap3.removeKey(collision3);
    hashMap3.put(collision4, false);
    Assert.assertEquals(this.newWithKeysValues(collision1, true, collision4, false), hashMap3);

    MutableObjectBooleanMap<String> hashMap4 = this.getEmptyMap();
    hashMap4.put(null, false);
    Assert.assertEquals(this.newWithKeysValues(null, false), hashMap4);
    hashMap4.put(null, true);
    Assert.assertEquals(this.newWithKeysValues(null, true), hashMap4);
  }
  @Test
  public void testToString() {
    Assert.assertEquals("[]", this.getEmptyMap().toString());
    Assert.assertEquals("[0=false]", this.newWithKeysValues(0, false).toString());
    Assert.assertEquals("[1=true]", this.newWithKeysValues(1, true).toString());
    Assert.assertEquals("[5=true]", this.newWithKeysValues(5, true).toString());

    MutableObjectBooleanMap<Integer> map1 = this.newWithKeysValues(0, true, 1, false);
    Assert.assertTrue(
        map1.toString(),
        "[0=true, 1=false]".equals(map1.toString()) || "[1=false, 0=true]".equals(map1.toString()));

    MutableObjectBooleanMap<Integer> map2 = this.newWithKeysValues(1, false, null, true);
    Assert.assertTrue(
        map2.toString(),
        "[1=false, null=true]".equals(map2.toString())
            || "[null=true, 1=false]".equals(map2.toString()));

    MutableObjectBooleanMap<Integer> map3 = this.newWithKeysValues(1, true, null, true);
    Assert.assertTrue(
        map3.toString(),
        "[1=true, null=true]".equals(map3.toString())
            || "[null=true, 1=true]".equals(map3.toString()));
  }
  @Test
  public void getIfAbsentPut_Function() {
    BooleanFunction0 factory =
        new BooleanFunction0() {
          public boolean value() {
            return true;
          }
        };

    MutableObjectBooleanMap<Integer> map1 = this.getEmptyMap();
    Assert.assertTrue(map1.getIfAbsentPut(0, factory));
    BooleanFunction0 factoryThrows =
        new BooleanFunction0() {
          public boolean value() {
            throw new AssertionError();
          }
        };
    Assert.assertTrue(map1.getIfAbsentPut(0, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true), map1);
    Assert.assertTrue(map1.getIfAbsentPut(1, factory));
    Assert.assertTrue(map1.getIfAbsentPut(1, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true, 1, true), map1);

    MutableObjectBooleanMap<Integer> map2 = this.getEmptyMap();
    BooleanFunction0 factoryFalse =
        new BooleanFunction0() {
          public boolean value() {
            return false;
          }
        };
    Assert.assertFalse(map2.getIfAbsentPut(1, factoryFalse));
    Assert.assertFalse(map2.getIfAbsentPut(1, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(1, false), map2);
    Assert.assertFalse(map2.getIfAbsentPut(0, factoryFalse));
    Assert.assertFalse(map2.getIfAbsentPut(0, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(0, false, 1, false), map2);

    MutableObjectBooleanMap<Integer> map3 = this.getEmptyMap();
    Assert.assertTrue(map3.getIfAbsentPut(null, factory));
    Assert.assertTrue(map3.getIfAbsentPut(null, factoryThrows));
    Assert.assertEquals(this.newWithKeysValues(null, true), map3);
  }
  @Test
  public void getIfAbsentPutWithKey() {
    BooleanFunction<Integer> function =
        new BooleanFunction<Integer>() {
          public boolean booleanValueOf(Integer anObject) {
            return anObject == null || (anObject & 1) == 0;
          }
        };

    MutableObjectBooleanMap<Integer> map1 = this.getEmptyMap();
    Assert.assertTrue(map1.getIfAbsentPutWithKey(0, function));
    BooleanFunction<Integer> functionThrows =
        new BooleanFunction<Integer>() {
          public boolean booleanValueOf(Integer anObject) {
            throw new AssertionError();
          }
        };
    Assert.assertTrue(map1.getIfAbsentPutWithKey(0, functionThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true), map1);
    Assert.assertFalse(map1.getIfAbsentPutWithKey(1, function));
    Assert.assertFalse(map1.getIfAbsentPutWithKey(1, functionThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true, 1, false), map1);

    MutableObjectBooleanMap<Integer> map2 = this.getEmptyMap();
    Assert.assertFalse(map2.getIfAbsentPutWithKey(1, function));
    Assert.assertFalse(map2.getIfAbsentPutWithKey(1, functionThrows));
    Assert.assertEquals(this.newWithKeysValues(1, false), map2);
    Assert.assertTrue(map2.getIfAbsentPutWithKey(0, function));
    Assert.assertTrue(map2.getIfAbsentPutWithKey(0, functionThrows));
    Assert.assertEquals(this.newWithKeysValues(0, true, 1, false), map2);

    MutableObjectBooleanMap<Integer> map3 = this.getEmptyMap();
    Assert.assertTrue(map3.getIfAbsentPutWithKey(null, function));
    Assert.assertTrue(map3.getIfAbsentPutWithKey(null, functionThrows));
    Assert.assertEquals(this.newWithKeysValues(null, true), map3);
  }
  @Test
  public void getIfAbsentPutWith() {
    BooleanFunction<String> functionLengthEven =
        new BooleanFunction<String>() {
          public boolean booleanValueOf(String string) {
            return (string.length() & 1) == 0;
          }
        };

    MutableObjectBooleanMap<Integer> map1 = this.getEmptyMap();
    Assert.assertFalse(map1.getIfAbsentPutWith(0, functionLengthEven, "123456789"));
    BooleanFunction<String> functionThrows =
        new BooleanFunction<String>() {
          public boolean booleanValueOf(String string) {
            throw new AssertionError();
          }
        };
    Assert.assertFalse(map1.getIfAbsentPutWith(0, functionThrows, "unused"));
    Assert.assertEquals(this.newWithKeysValues(0, false), map1);
    Assert.assertFalse(map1.getIfAbsentPutWith(1, functionLengthEven, "123456789"));
    Assert.assertFalse(map1.getIfAbsentPutWith(1, functionThrows, "unused"));
    Assert.assertEquals(this.newWithKeysValues(0, false, 1, false), map1);

    MutableObjectBooleanMap<Integer> map2 = this.getEmptyMap();
    Assert.assertTrue(map2.getIfAbsentPutWith(1, functionLengthEven, "1234567890"));
    Assert.assertTrue(map2.getIfAbsentPutWith(1, functionThrows, "unused0"));
    Assert.assertEquals(this.newWithKeysValues(1, true), map2);
    Assert.assertTrue(map2.getIfAbsentPutWith(0, functionLengthEven, "1234567890"));
    Assert.assertTrue(map2.getIfAbsentPutWith(0, functionThrows, "unused0"));
    Assert.assertEquals(this.newWithKeysValues(0, true, 1, true), map2);

    MutableObjectBooleanMap<Integer> map3 = this.getEmptyMap();
    Assert.assertFalse(map3.getIfAbsentPutWith(null, functionLengthEven, "123456789"));
    Assert.assertFalse(map3.getIfAbsentPutWith(null, functionThrows, "unused"));
    Assert.assertEquals(this.newWithKeysValues(null, false), map3);
  }