Skip to content

Instantly share code, notes, and snippets.

public class LazyValue<T> implements Supplier<T> {
private volatile T value;
private final Supplier<T> producer;
private final Object lock = new Object();
public LazyValue(Supplier<T> producer) {
this.producer = producer;
}
@Override