I have to make a HashMap of point and Array-list. point is nothing but the pair of x and y in x-y plain.
then i want to store all student’s roll no. which are there at that specific point.
as we don’t have pair in java, so for point, i created another class named pair, which has int x and int y two variable and also it has two methods to access x and y. and one constructor to initialize x and y.
Now the main problem is :
when i wanna add new point to the hash-map, i create a new object of pair class and push the roll no.
but problem is that, How can i check that any point is already existing in the HashMap or not.
when i use map.containsKey() i have to pass that pair but how i will pass that pair, to pass pair i will create another object and when i pass it to containsKey() function it don’t detect the already existing (x,y) pair.and add the same (x,y) pair as new key in hashmap.