Define a method with this header in a class named quizQuesti
Solution
//To create a hashset of type Point
class Point
 {
    private int x;
    private int y;
    private int value;
   
    public Point(){}
    public Point(int x, int y, int value)
    {
        this.x=x;
        this.y=y;
        this.value=value;
    }
    public int hashCode()
    {
        int hashcode = 0;
        hashcode = x*5;
        hashcode += value.hashcode();
        return hashcode;
    }
    public boolean equals(Object obj)
    {
    if (obj instanceof Point)
        {
        Point p = (Point) obj;
        return (p.value == this.value);
    }
        else
        {
        return false;
    }
    }
    public int getX()
    {
        return x;
    }
    public void setX(int x)
    {
        this.x = x;
    }
    public int getY()
    {
        return y;
    }
    public void setY(int y)
    {
        this.y = y;  
    }
    public int getValue()
    {
        return value;
    }
    public void setValue(int value)
    {
        this.value = value;  
    }
    public String toString()
    {
        return \"(\"+x+\",\"+y+\")\";
    }
 }
 class Test
 {
//Method with the requested header in the question
public HashSet<Point> answer(Point p, ArrayList<ArrayList<String>> board)
 {
    if(p != null)
    {
        HashSet<Point> hs = new HashSet<Point>();
        if(board != null && board.isEmpty())
        {
            int x = p.getX();
            int y = p.getY();
            ArrayList<Point> adj = new ArrayList<Point>();
            for(int i=0; i<board.size(); i++)
            {
                for(int j=0; j<board.size(); i++)
                {
                    if(abs(i,x)==1 || abs(j,y)==1)
                    {
                        Point s = new Point(i,j);
                        adj.add(s);
                    }
                }
            }
            HashSet<Point> match = new HashSet<Point>();
            for(int i = 0; i<adj.size(); i++)
            {
                Point s = adj.get(i);
                if(p.equals(s)
                {
                    match.add(s);
                }
            }
            return s;
        }
        else
        {
            retun null;
        }
    }
    else
    {
        retun null;
    }
 }
 public static void main(Sttring args[])
 {
    //code to call the method answer as required
 }
 }


