Beispiel #1
0
  @Override
  public void withKeyValue() {
    MutableMap<Integer, String> map1 =
        new SingletonMap<Integer, String>(1, "A").withKeyValue(2, "B");
    Verify.assertMapsEqual(UnifiedMap.newWithKeysValues(1, "A", 2, "B"), map1);
    Verify.assertInstanceOf(DoubletonMap.class, map1);

    MutableMap<Integer, String> map2 = new SingletonMap<Integer, String>(1, "A");
    MutableMap<Integer, String> map2with = map2.withKeyValue(1, "AA");
    Verify.assertMapsEqual(UnifiedMap.newWithKeysValues(1, "AA"), map2with);
    Assert.assertSame(map2, map2with);
  }
Beispiel #2
0
 @Override
 public void withoutAllKeys() {
   MutableMap<Integer, String> map = new SingletonMap<Integer, String>(1, "A");
   MutableMap<Integer, String> mapWithout = map.withoutAllKeys(FastList.newListWith(2, 3));
   Assert.assertSame(map, mapWithout);
   mapWithout = map.withoutAllKeys(FastList.newListWith(1, 2));
   Verify.assertMapsEqual(UnifiedMap.newMap(), mapWithout);
   Verify.assertInstanceOf(EmptyMap.class, mapWithout);
 }
Beispiel #3
0
 @Override
 public void withoutKey() {
   MutableMap<Integer, String> map = new SingletonMap<Integer, String>(1, "A");
   MutableMap<Integer, String> mapWithout = map.withoutKey(2);
   Assert.assertSame(map, mapWithout);
   mapWithout = map.withoutKey(1);
   Verify.assertMapsEqual(UnifiedMap.newMap(), mapWithout);
   Verify.assertInstanceOf(EmptyMap.class, mapWithout);
 }