LazyValue implements Supplier<T> { @Override public T get () { if (value == null) { synchronized (this) { if (value == null) { value = createValue(); } } } return value; }  boolean hasValue(); @Override T get();  }
@Test public void testGet() { LazyValue<String> lazyValue = create(); String get1 = lazyValue.get(); String get2 = lazyValue.get(); assertSame(get1, get2); }