mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
26 lines
450 B
Java
26 lines
450 B
Java
class Test {
|
|
|
|
public static void main(String[] args) {
|
|
Box<String> stringBox = new Box<String>("123");
|
|
|
|
stringBox.transform(new Fn<String,<error descr="Identifier expected"> </error>>() {});
|
|
|
|
}
|
|
|
|
static class Box<T> {
|
|
T value;
|
|
|
|
Box(T value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public <O> Box<O> transform(Fn<T, O> fn) {
|
|
return new Box<O>(fn.apply(value));
|
|
}
|
|
}
|
|
|
|
interface Fn<A, B> {
|
|
B apply(A value);
|
|
}
|
|
}
|