I have array with points: Point[] p = new Point[]
I want to sort it by x, and then by y. Meaning, If I have
Point A = (1, 2)
Point B = (2, 1)
Point C = (1, 3)
Point D = (2, 2)
After sorting, I will get: [(1,2), (1,3), (2,1), (2,2)]
I try to use Arrays.sort(), but point isn't comparable. There is an easy way to do that?
ComparatororComparableinterface.