Highlight Two Closest Points Java Swing
I think the logic for getting the minimal distance between the points would work even without the explicit check against MAX_INT:

private void updateClosestPair() {
    for (int i = 0; i &lt; points.size() - 1; i++) {
        int testDistance = getDistance(points.get(i), points.get(points.size() - 1));
        if (testDistance &lt; minDistance) {
            minDistance = testDistance;
            closestPairIndices[0] = i;
            closestPairIndices[1] = points.size() - 1;
        }
    }
}


Although I did not run the above code, I am convinced that it would just work also for the first pair (or it could be fixed with minimal changes), since it would just check the second point against the first one, and set their distance as the minimum.
Going one step further, you also don't need to check that there are at least two points, when calling updateClosestPair. In this case, the iteration would never start at all.