java/ch/wlkl/javaExamples/Functional.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ch.wlkl.javaExamples;
import static ch.wlkl.javaExamples.Util.*;
import java.util.function.Function;
/**
*
* @author walter
*/
public class Functional implements Function<Integer, String> {
public static void xy(String s) {say("x1: " + s); }
public static String xy = "xy String";
public String apply(Integer i) {
return "square=" + (i*i);
}
public String Functional(Integer i) {
return "Functional " + apply(i);
}
public static void main( String... args) {
Functional f = new Functional();
say(f.apply(1));
// f(2);
say("xy static field " + xy);
xy("xy function");
say(f.Functional(3));
}
}