I'm trying to modify the code, but got the error listed in the title.Anyone please help.
Error: The method segments() in the type BruteCollinearPoints is not applicable for the arguments (Point, Point)
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import edu.princeton.cs.algs4.*;
public class BruteCollinearPoints
{
public BruteCollinearPoints(Point[] points) // finds all line segments containing 4 points
{
int N = points.length;
int i = 0;
for (int p = 0; p < N; p++) {
for (int q = p + 1; q < N; q++) {
double slopeToQ = points[p].slopeTo(points[q]);
for (int r = q + 1; r < N; r++) {
double slopeToR = points[p].slopeTo(points[r]);
if (slopeToQ == slopeToR) {
for (int s = r + 1; s < N; s++) {
double slopeToS = points[p].slopeTo(points[s]);
if (slopeToQ == slopeToS) {
// Create the list of collinear points and sort them.
List<Point> collinearPoints = new ArrayList<Point>(4);
collinearPoints.add(points[p]);
collinearPoints.add(points[q]);
collinearPoints.add(points[r]);
collinearPoints.add(points[s]);
Collections.sort(collinearPoints);
segments(Collections.min(collinearPoints), Collections.max(collinearPoints)); //this is where the error is
}
}
}
}
}
}
}
//public int numberOfSegments(); // the number of line segments
public LineSegment[] segments() // the line segments
{
return segments();
}
}