bidirectionalComparator property
A {@link Comparator} for {@link Coordinate} arrays modulo their directionality. E.g. if two coordinate arrays are identical but reversed they will compare as equal under this ordering. If the arrays are not equal, the ordering returned is the ordering in the forward direction.
Implementation
static Comparator<List<Coordinate>> bidirectionalComparator = (pts1, pts2) {
if (pts1.length < pts2.length) return -1;
if (pts1.length > pts2.length) return 1;
if (pts1.isEmpty) return 0;
int forwardComp = CoordinateArrays.compare(pts1, pts2);
bool isEqualRev = isEqualReversed(pts1, pts2);
if (isEqualRev) {
return 0;
}
return forwardComp;
};