/**
 * Test the amazingly trivial I2I class.
 */
public class TestI2I
{
  public static void test(I2I func)
  {
    System.out.println("Applying the function to 2, I get " + func.applyTo(2));
    System.out.println("Applying the function to 3, I get " + func.applyTo(3));
  } // test(I2I)

  public static void main(String[] args)
  {
    I2I square = new I2I() { 
      public int applyTo(int i) { return i*i; }
    }; 
    I2I increment = new I2I() {
      public int applyTo(int i) { return i+1; }
    };
    System.out.println("**** TESTING SQUARE ****");
    test(square);
    System.out.println("**** TESTING INCREMENT ****");
    test(increment);
    System.out.println("**** TESTING ANONYMOUS DOUBLE ****");
    test(new I2I() { public int applyTo(int i) { return i*2; } });
  } // main(String[])
} // TestI2I

