Package java.util

Examples of java.util.IdentityHashMap$IdentityHashMapEntry


    assertSame("HashMap(10)", map2.values(), map2.values());

    Map map3 = Collections.EMPTY_MAP;
    assertSame("EMPTY_MAP", map3.values(), map3.values());

    AbstractMap map4 = new IdentityHashMap(1);
    assertSame("IdentityHashMap", map4.values(), map4.values());

    AbstractMap map5 = new LinkedHashMap(122);
    assertSame("IdentityHashMap", map5.values(), map5.values());

    AbstractMap map6 = new TreeMap();
View Full Code Here


    assertSame("HashMap(10)", map2.keySet(), map2.keySet());

    Map map3 = Collections.EMPTY_MAP;
    assertSame("EMPTY_MAP", map3.keySet(), map3.keySet());

    AbstractMap map4 = new IdentityHashMap(1);
    assertSame("IdentityHashMap", map4.keySet(), map4.keySet());

    AbstractMap map5 = new LinkedHashMap(122);
    assertSame("LinkedHashMap", map5.keySet(), map5.keySet());

    AbstractMap map6 = new TreeMap();
View Full Code Here

    AbstractMap map1 = new HashMap(0);
    map1.put("key", value);
    assertSame("HashMap(0)", map1.remove("key"), value);

    AbstractMap map4 = new IdentityHashMap(1);
    map4.put(key, value);
    assertSame("IdentityHashMap", map4.remove(key), value);

    AbstractMap map5 = new LinkedHashMap(122);
    map5.put(key, value);
    assertSame("LinkedHashMap", map5.remove(key), value);
View Full Code Here

  /**
   * @tests java.util.IdentityHashMap#IdentityHashMap()
   */
  public void test_Constructor() {
    // Test for method java.util.IdentityHashMap()
    new Support_MapTest2(new IdentityHashMap()).runTest();

    IdentityHashMap hm2 = new IdentityHashMap();
    assertEquals("Created incorrect IdentityHashMap", 0, hm2.size());
  }
View Full Code Here

  /**
   * @tests java.util.IdentityHashMap#IdentityHashMap(int)
   */
  public void test_ConstructorI() {
    // Test for method java.util.IdentityHashMap(int)
    IdentityHashMap hm2 = new IdentityHashMap(5);
    assertEquals("Created incorrect IdentityHashMap", 0, hm2.size());
    try {
      new IdentityHashMap(-1);
    } catch (IllegalArgumentException e) {
      return;
    }
    fail(
        "Failed to throw IllegalArgumentException for initial capacity < 0");

    IdentityHashMap empty = new IdentityHashMap(0);
    assertNull("Empty IdentityHashMap access", empty.get("nothing"));
    empty.put("something", "here");
    assertTrue("cannot get element", empty.get("something") == "here");
  }
View Full Code Here

  public void test_ConstructorLjava_util_Map() {
    // Test for method java.util.IdentityHashMap(java.util.Map)
    Map myMap = new TreeMap();
    for (int counter = 0; counter < hmSize; counter++)
      myMap.put(objArray2[counter], objArray[counter]);
    IdentityHashMap hm2 = new IdentityHashMap(myMap);
    for (int counter = 0; counter < hmSize; counter++)
      assertTrue("Failed to construct correct IdentityHashMap", hm
          .get(objArray2[counter]) == hm2.get(objArray2[counter]));
   
        Map mockMap = new MockMap();
        hm2 = new IdentityHashMap(mockMap);
        assertEquals("Size should be 0", 0, hm2.size());
  }
View Full Code Here

  /**
   * @tests java.util.IdentityHashMap#clone()
   */
  public void test_clone() {
    // Test for method java.lang.Object java.util.IdentityHashMap.clone()
    IdentityHashMap hm2 = (IdentityHashMap) hm.clone();
    assertTrue("Clone answered equivalent IdentityHashMap", hm2 != hm);
    for (int counter = 0; counter < hmSize; counter++)
      assertTrue("Clone answered unequal IdentityHashMap", hm
          .get(objArray2[counter]) == hm2.get(objArray2[counter]));

    IdentityHashMap map = new IdentityHashMap();
    map.put("key", "value");
    // get the keySet() and values() on the original Map
    Set keys = map.keySet();
    Collection values = map.values();
    assertEquals("values() does not work",
        "value", values.iterator().next());
    assertEquals("keySet() does not work",
        "key", keys.iterator().next());
    AbstractMap map2 = (AbstractMap) map.clone();
    map2.put("key", "value2");
    Collection values2 = map2.values();
    assertTrue("values() is identical", values2 != values);
    // values() and keySet() on the cloned() map should be different
    assertEquals("values() was not cloned",
View Full Code Here

        .containsKey(objArray2[23]));
    assertTrue("Returned true for copy of valid key", !hm
        .containsKey(new Integer(23).toString()));
    assertTrue("Returned true for invalid key", !hm.containsKey("KKDKDKD"));

    IdentityHashMap m = new IdentityHashMap();
    m.put(null, "test");
    assertTrue("Failed with null key", m.containsKey(null));
    assertTrue("Failed with missing key matching null hash", !m
        .containsKey(new Integer(0)));
  }
View Full Code Here

        hm.get("T"));
    hm.put("T", "HELLO");
    assertEquals("Get returned incorecct value for existing key", "HELLO", hm.get("T")
        );

    IdentityHashMap m = new IdentityHashMap();
    m.put(null, "test");
    assertEquals("Failed with null key", "test", m.get(null));
    assertNull("Failed with missing key matching null hash", m
        .get(new Integer(0)));
  }
View Full Code Here

  /**
   * @tests java.util.IdentityHashMap#isEmpty()
   */
  public void test_isEmpty() {
    // Test for method boolean java.util.IdentityHashMap.isEmpty()
    assertTrue("Returned false for new map", new IdentityHashMap()
        .isEmpty());
    assertTrue("Returned true for non-empty", !hm.isEmpty());
  }
View Full Code Here

TOP

Related Classes of java.util.IdentityHashMap$IdentityHashMapEntry

Copyright © 2018 www.massapicom. 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.