How to find the distance between any 2 points in the image provided.
class Point{
private Map<Point, Integer> nextPoints;
private Map<Point, Integer> previousPoints;
public void setNextPoint(Point next, int distance){
if(!nextPoints.contains(next){
nextPoints.put(next, distance);
next.previousPoints.put(this, distance);
}