user7747934
user7747934

Reputation:

Using BiIntPredicate in Java

I have the following interface

public interface BiIntPredicate
{
   public boolean test(int x, int y);    
}

and have this class

public class Class
{
   public static final int BOUND=5;

   public static void printFigure(BiIntPredicate b) {
       for (int i=1; i<=BOUND; i++) {
           for (int j=1; j<=BOUND; j++) {
               if (b.test(i,j)) System.out.print("*");
               else System.out.print(" ");
           }
           System.out.println();
       }
   }
}

I am using blueJ and am trying to figure out the parameters to enter in order to print out this figure.

*****
*****
*****
*****
*****

I don't understand how to enter the parameters to print this out.

Upvotes: 1

Views: 419

Answers (1)

shmosel
shmosel

Reputation: 50726

To print asterisks unconditionally, call it like this:

printFigure((i, j) -> true);

Upvotes: 1

Related Questions