In hashmap how to give Integers in below form repersentation.i tried but i can't get solution.
(1,2)=17;
In hashmap how to give Integers in below form repersentation.i tried but i can't get solution.
(1,2)=17;
This is a multi-key hashmap. The basic idea is to create two hashmaps and chain them together. See this question for a duplicate answer.
Step 1: Create a custom Tuple class. Use the code from accepted answer to this question => Using Pairs or 2-tuples in Java.
Thanks to @azurefrog for the tip.
Step 2: The type of the HashMap holding this would be
HashMap<Tuple, Integer> myMap = new HashMap<Tuple, Integer>();
Hope this helps :-)