how to make a map in java code example
Example 1: java create map
Map <Integer, Point2D.Double> hm = new HashMap<Integer, Point2D>();
hm.put(1, new Point2D.Double(50, 50));
Example 2: map in java
MAP : is a (key-value format)
and keys are always unique,
and value can be duplicated.
- HashTable don't have null key, sychronized(thread-safe)
- LinkedHashMap can have null key, keeps order
- HasHMap can have null key, order is not guaranteed
- TreeMap doesn't have null key and keys are sorted