There are three points, A (x1, y1), B (x2, y2), C (x3, y3), you need to know if they belong to the same straight line, there is also an enum with types of functions, while there is only LINE, and there is also a functional interface in which there is a function method, and depending on the selected function, it is calculated whether the points belong to the same line, but there is a problem, I don’t know how to write the solution in java, here’s the code:
//functionType.java public enum functionType{ LINE } //Coordinates.java public class Coordinates{ private final int x, y; public Coordinates(int x, int y){ this.x = x; this.y = y; } public int getX(){ return x; } public int getY(){ return y; } //Вот в этом методе проблема: public boolean canMove(Coordinates point1, Coordinates point2, Coordinates point3, functionType type){ if(type == functionType.LINE){ Function function = (Coordinates point1, Coordinates point2, Coordinates point3) ->{ } } } //Function.java public interface Function{ public boolean function(Coordinates point1, Coordinates point2, Coordinates point3); } How to implement a method which in lambda expression? Thanks in advance!