Package java.util

Examples of java.util.IdentityHashMap.containsKey()


    assertNull("testB put returned wrong value", result);

    // a null key
    String key = "a key";
    result = map.put(key, null);
    assertTrue("testC can not find a key with null value", map
        .containsKey(key));
    assertTrue("testC can not find null value", map.containsValue(null));
    assertNull("testC can not get null value for key", map.get(key));
    assertNull("testC put returned wrong value", result);
View Full Code Here


    assertNull("testC put returned wrong value", result);

    // another null key
    String anothervalue = "another value";
    result = map.put(null, anothervalue);
    assertTrue("testD can not find null key", map.containsKey(null));
    assertTrue("testD can not find a value with null key", map
        .containsValue(anothervalue));
    assertTrue("testD can not get value for null key",
        map.get(null) == anothervalue);
    assertTrue("testD put returned wrong value", result == value);
View Full Code Here

    assertTrue("testD put returned wrong value", result == value);

    // remove a null key
    result = map.remove(null);
    assertTrue("testE remove returned wrong value", result == anothervalue);
    assertTrue("testE should not find null key", !map.containsKey(null));
    assertTrue("testE should not find a value with null key", !map
        .containsValue(anothervalue));
    assertNull("testE should not get value for null key",
        map.get(null));
  }
View Full Code Here

    map.put(null, null);
    map.put("key1", "value1");
    map.put("key2", "value2");
    map.remove("key1");

    assertTrue("Did not remove key1", !map.containsKey("key1"));
    assertTrue("Did not remove the value for key1", !map
        .containsValue("value1"));

    assertTrue("Modified key2", map.get("key2") != null
        && map.get("key2") == "value2");
View Full Code Here

    while (it.hasNext()) {
      Map.Entry entry = (Map.Entry) it.next();
      assertTrue("EntrySetIterator can not find entry ", entries
          .contains(entry));

      assertTrue("entry key not found in map", map.containsKey(entry
          .getKey()));
      assertTrue("entry value not found in map", map.containsValue(entry
          .getValue()));

      assertTrue("entry key not found in the keyset", keyset
View Full Code Here

    map.put(key, value);

    Collection vals = map.values();
    boolean result = vals.remove(key);
    assertTrue("removed entries incorrectly", map.size() == 11 && !result);
    assertTrue("removed key incorrectly", map.containsKey(key));
    assertTrue("removed value incorrectly", map.containsValue(value));

    result = vals.remove(value);
    assertTrue("Did not remove entry as expected", map.size() == 10
        && result);
View Full Code Here

    assertTrue("removed value incorrectly", map.containsValue(value));

    result = vals.remove(value);
    assertTrue("Did not remove entry as expected", map.size() == 10
        && result);
    assertTrue("Did not remove key as expected", !map.containsKey(key));
    assertTrue("Did not remove value as expected", !map
        .containsValue(value));

    // put an equivalent key to a value
    key = new Integer(1);
View Full Code Here

    map.put(key, value);

    result = vals.remove(key);
    assertTrue("TestB. removed entries incorrectly", map.size() == 11
        && !result);
    assertTrue("TestB. removed key incorrectly", map.containsKey(key));
    assertTrue("TestB. removed value incorrectly", map.containsValue(value));

    result = vals.remove(value);
    assertTrue("TestB. Did not remove entry as expected", map.size() == 10
        && result);
View Full Code Here

    assertTrue("TestB. removed value incorrectly", map.containsValue(value));

    result = vals.remove(value);
    assertTrue("TestB. Did not remove entry as expected", map.size() == 10
        && result);
    assertTrue("TestB. Did not remove key as expected", !map
        .containsKey(key));
    assertTrue("TestB. Did not remove value as expected", !map
        .containsValue(value));

    vals.clear();
View Full Code Here

    int size = newset.size();
    assertTrue("keyset and newset don't have same size",
        newset.size() == size);
    assertTrue("element is in newset ", !newset.contains(key));
    assertTrue("element not removed from keyset", !set.contains(key));
    assertTrue("element not removed from map", !map.containsKey(key));

    assertTrue("newset and keyset do not have same elements 1", newset
        .equals(set));
    assertTrue("newset and keyset do not have same elements 2", set
        .equals(newset));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.