Show the basic usage of Function objects.
More...
|
class | IntegerDivision |
| A function that computes integer division.
|
|
|
static void | main (String[] args) |
|
Show the basic usage of Function objects.
Sylvain Hallé Easy
Definition at line 35 of file FunctionUsage.java.
◆ main()
static void functions.FunctionUsage.main |
( |
String [] |
args | ) |
|
|
static |
We create an instance of the negation function. The class
Definition at line 37 of file FunctionUsage.java.
41 Function negation = Booleans.not;
44 Object[] out =
new Object[1];
48 negation.evaluate(
new Object[]{
true}, out);
51 System.out.println(
"The return value of the function is: " + out[0]);
56 Function addition = Numbers.addition;
60 addition.evaluate(
new Object[]{2, 3}, out);
63 System.out.println(
"The return value of the function is: " + out[0]);
70 Function int_division = IntegerDivision.instance;
71 Object[] outs =
new Object[2];
72 int_division.evaluate(
new Object[]{14, 3}, outs);
73 System.out.println(
"14 divided by 3 equals " +
74 outs[0] +
" remainder " + outs[1]);
The documentation for this class was generated from the following file: