I have different elements of different types such as:
<0, "none">, <0, "constructor">, <0, "none">, <0, "method">, <1, "method">, <2, "constructor">, <2, "method">, <2, "constructor">
I would like to store them in a map or any other data structure without removing duplicates. I implemented the map as the following:
Map<Integer, String> m1 = new HashMap<>();
m1.put(0, "none");
m1.put(0, "constructor");
m1.put(1, "none");
m1.put(0, "method");
The result of printing m1
is {0=method, 1=method, 2=constructor}
which I don't want. I want to show all the elements.