mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
24 lines
423 B
Kotlin
Vendored
24 lines
423 B
Kotlin
Vendored
// FILE: test.kt
|
|
class Test : Base {
|
|
constructor(f: () -> String) : super(f)
|
|
}
|
|
|
|
fun box() = Test({ "OK" }).get()
|
|
|
|
// FILE: Supplier.java
|
|
public interface Supplier<T> {
|
|
T get();
|
|
}
|
|
|
|
// FILE: Base.java
|
|
public class Base {
|
|
private final Supplier<String> supplier;
|
|
|
|
public Base(Supplier<String> supplier) {
|
|
this.supplier = supplier;
|
|
}
|
|
|
|
public String get() {
|
|
return supplier.get();
|
|
}
|
|
} |