@Test
  public void retainAllFromValues() {
    MutableMapIterable<String, Integer> map =
        this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
    Assert.assertFalse(map.values().retainAll(FastList.newListWith(1, 2, 3, 4)));

    Assert.assertTrue(map.values().retainAll(FastList.newListWith(1, 3)));
    Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
  }
  @Test
  public void removeFromValues() {
    MutableMapIterable<String, Integer> map =
        this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
    Assert.assertFalse(map.values().remove(4));

    Assert.assertTrue(map.values().remove(2));
    Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Three", 3), map);
  }
 @Test
 public void updateValue_collisions() {
   MutableMapIterable<Integer, Integer> map = this.newMap();
   MutableList<Integer> list = Interval.oneTo(2000).toList();
   Collections.shuffle(list);
   Iterate.forEach(list, each -> map.updateValue(each % 1000, () -> 0, integer -> integer + 1));
   Assert.assertEquals(Interval.zeroTo(999).toSet(), map.keySet());
   Assert.assertEquals(
       HashBag.newBag(map.values()).toStringOfItemToCount(),
       FastList.newList(Collections.nCopies(1000, 2)),
       FastList.newList(map.values()));
 }
  @Test
  public void removeNullFromValues() {
    if (this.newMap() instanceof ConcurrentMap) {
      return;
    }

    MutableMapIterable<String, Integer> map =
        this.newMapWithKeysValues("One", 1, "Two", 2, "Three", 3);
    Assert.assertFalse(map.values().remove(null));
    Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
    map.put("Four", null);
    Assert.assertTrue(map.values().remove(null));
    Assert.assertEquals(UnifiedMap.newWithKeysValues("One", 1, "Two", 2, "Three", 3), map);
  }
 @Test
 public void keysAndValues_toString() {
   MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2");
   Verify.assertContains(map.keySet().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
   Verify.assertContains(map.values().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
   Verify.assertContains(map.keysView().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
   Verify.assertContains(map.valuesView().toString(), FastList.newListWith("[1, 2]", "[2, 1]"));
 }
 @Test
 public void updateValue() {
   MutableMapIterable<Integer, Integer> map = this.newMap();
   Iterate.forEach(
       Interval.oneTo(1000), each -> map.updateValue(each % 10, () -> 0, integer -> integer + 1));
   Assert.assertEquals(Interval.zeroTo(9).toSet(), map.keySet());
   Assert.assertEquals(
       FastList.newList(Collections.nCopies(10, 100)), FastList.newList(map.values()));
 }
 @Test
 public void updateValueWith() {
   MutableMapIterable<Integer, Integer> map = this.newMap();
   Iterate.forEach(
       Interval.oneTo(1000),
       each ->
           map.updateValueWith(
               each % 10,
               () -> 0,
               (integer, parameter) -> {
                 Assert.assertEquals("test", parameter);
                 return integer + 1;
               },
               "test"));
   Assert.assertEquals(Interval.zeroTo(9).toSet(), map.keySet());
   Assert.assertEquals(
       FastList.newList(Collections.nCopies(10, 100)), FastList.newList(map.values()));
 }
 @Test
 public void getKeysAndGetValues() {
   MutableMapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
   Verify.assertContainsAll(map.keySet(), 1, 2, 3);
   Verify.assertContainsAll(map.values(), "1", "2", "3");
 }