private List < Coordinate > sortY ( List < Coordinate > coordinates ) { List < Coordinate > sorted = new ArrayList < Coordinate > ( coordinates ) ; Collections . sort ( sorted , new YComparator ( ) ) ; return sorted ; }
Return a new and sorted list of coordinates . They should be sorted by their Y values .