mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 10:51:06 +07:00
17 lines
316 B
Java
17 lines
316 B
Java
import java.util.function.Supplier;
|
|
|
|
class Foo {
|
|
private final Singleton<B> singletonB = new Singleton<>(() -> f());
|
|
static B f() {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
interface B {
|
|
String getData();
|
|
}
|
|
|
|
class Singleton<T> {
|
|
public Singleton(Supplier<T> supplier) { }
|
|
public Singleton(T instance) { }
|
|
} |