Example usage for java.util IdentityHashMap IdentityHashMap

List of usage examples for java.util IdentityHashMap IdentityHashMap

Introduction

In this page you can find the example usage for java.util IdentityHashMap IdentityHashMap.

Prototype

public IdentityHashMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Constructs a new identity hash map containing the keys-value mappings in the specified map.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    IdentityHashMap<Object, Object> objMap = new IdentityHashMap<Object, Object>(5);

    Object o1 = new Integer(123);
    Object o2 = new Integer(123);
    objMap.put(o1, "first");
    objMap.put(o2, "second");

    Object v1 = objMap.get(o1); // first
    Object v2 = objMap.get(o2); // second
}

From source file:Main.java

public static void main(String[] args) {
    Map<Employee, String> map2 = new HashMap<Employee, String>();
    Employee e2 = new Employee("J", 26);
    map2.put(e2, "MGMT");
    System.out.println(map2);//from  w w  w  .  ja v  a 2s .  co m
    e2.setAge(27);
    System.out.println(map2);
    System.out.println(map2.containsKey(e2));//false

    IdentityHashMap<Employee, String> map1 = new IdentityHashMap<Employee, String>(map2);

    System.out.println(map1);
}

From source file:Main.java

public static <K, V> IdentityHashMap<K, V> getIdentityHashMap(int initialCapacity) {
    return new IdentityHashMap<K, V>(initialCapacity);
}

From source file:Main.java

public static <K, V> IdentityHashMap<K, V> createIdentityHashMap(int initialCapacity) {
    return new IdentityHashMap<K, V>(initialCapacity);
}

From source file:Main.java

public static <K, V> Map<K, V> makeIdentityMap(int size) {
    return new IdentityHashMap<K, V>(size);
}

From source file:Main.java

public static <K, V> IdentityHashMap<K, V> getIdentityHashMap(Map<? extends K, ? extends V> map) {
    return new IdentityHashMap<K, V>(map);
}

From source file:Main.java

public static <K, V> Map<K, V> makeIdentityMap(Map<? extends K, ? extends V> map) {
    return new IdentityHashMap<K, V>(map);
}

From source file:Main.java

public static <K, V> IdentityHashMap<K, V> createIdentityHashMap(Map<? extends K, ? extends V> map) {
    if (map == null) {
        return null;
    }//from  www  .  jav  a2  s  . c om

    return new IdentityHashMap<K, V>(map);
}

From source file:IdentitySet.java

public IdentitySet(int size) {
    this.map = new IdentityHashMap<Object, Object>(size);
}

From source file:gridool.db.DBLocalJob.java

public Map<GridTask, GridNode> map(GridRouter router, DBMapReduceJobConf jobConf) throws GridException {
    Map<GridTask, GridNode> map = new IdentityHashMap<GridTask, GridNode>(1);
    GridTask dbtask = jobConf.makeMapShuffleTask(this);
    GridNode localNode = getJobNode();//from  w  w  w .ja va  2s. c o m
    map.put(dbtask, localNode);
    return map;
}