stg12
stg12

Reputation: 1

Coordinates validation in java

Suppose that I am passing integer coordinates as arguments in java.For example, (1,2), (1,1), (2,2) would be passed as 1 2 1 1 2 2. Suppose further that I give each coordinate pair a label say 1,,,n where n is the number of pairs of coordinates. I would like to find a way so that if the same coordinate pair is given more than once, the label is updated to the new value.

Upvotes: 0

Views: 165

Answers (1)

Adnan
Adnan

Reputation: 496

Make a class with x ,y coordinates and label as its properties , store each object of this class in a hashmap use coordinate pair as its key and label as value , this will serve your purpose

Upvotes: 1

Related Questions