Package java.util

Examples of java.util.IdentityHashMap.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


    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();
View Full Code Here

    map.put(null, null);
    map.put("a key", null);
    map.put("another key", null);

    Set keyset = map.keySet();
    Collection valueset = map.values();
    Set entries = map.entrySet();
    Iterator it = entries.iterator();
    while (it.hasNext()) {
      Map.Entry entry = (Map.Entry) it.next();
      assertTrue("EntrySetIterator can not find entry ", entries
View Full Code Here

    Integer key = new Integer(20);
    Integer value = new Integer(40);
    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));
View Full Code Here

    map.put(null, null);
    map.put("a key", null);
    map.put("another key", null);

    Set keyset = map.keySet();
    Collection valueset = map.values();
    Set entries = map.entrySet();
    Iterator it = entries.iterator();
    while (it.hasNext()) {
      Map.Entry entry = (Map.Entry) it.next();
      assertTrue("EntrySetIterator can not find entry ", entries
View Full Code Here

    Integer key = new Integer(20);
    Integer value = new Integer(40);
    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));
View Full Code Here

        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

        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

    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();
View Full Code Here

          .contains(objArray[i]));

    IdentityHashMap myIdentityHashMap = new IdentityHashMap();
    for (int i = 0; i < 100; i++)
      myIdentityHashMap.put(objArray2[i], objArray[i]);
    Collection values = myIdentityHashMap.values();
    values.remove(objArray[0]);
    assertTrue(
        "Removing from the values collection should remove from the original map",
        !myIdentityHashMap.containsValue(objArray2[0]));
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.