I want a ConcurrentHashMap that have Integer key and Object value ( some value of map are Integer and another is String).
Is this the correct way to init and use my table ?
ConcurrentHashMap table=new ConcurrentHashMap<Integer, Comparable>();
table.put(new Integer(1), new String("nodata"));
table.put(new Integer(2), new Integer(23));
A few points
intvalues and wrapping a String literal is pointless..
You might want the following if you need the additional methods ConcurrentMap provides.
This appears to be a case of object denial. Using an Object is likely to be a better choice.
For a concurrent version of the same.