isEqualReversed static method

dynamic isEqualReversed(
  1. List<Coordinate> pts1,
  2. List<Coordinate> pts2
)

Determines whether two {@link Coordinate} arrays of equal length are equal in opposite directions.

@param pts1 @param pts2 @return true if the two arrays are equal in opposite directions.

Implementation

static isEqualReversed(List<Coordinate> pts1, List<Coordinate> pts2) {
  for (int i = 0; i < pts1.length; i++) {
    Coordinate p1 = pts1[i];
    Coordinate p2 = pts2[pts1.length - i - 1];
    if (p1.compareTo(p2) != 0) return false;
  }
  return true;
}