@Test void getSuccess() { Lazy<String> sut = new Lazy<>(() -> "Hello World"); String result = sut.get(); assertThat(result, is("Hello World")); }
public T get() { return tryGet().orElseThrow(); }
Lazy { public T get() { return tryGet().orElseThrow(); } }
Lazy { public T get() { return tryGet().orElseThrow(); } <E extends Exception> Lazy(ThrowingSupplier<T,E> supplier); }
Lazy { public T get() { return tryGet().orElseThrow(); } <E extends Exception> Lazy(ThrowingSupplier<T,E> supplier); Try<T> tryGet(); T get(); Optional<T> optional(); Stream<T> stream(); boolean isKnown(); boolean isKnownSuccess(); boolean isKnownFailure(); Lazy<U> map(ThrowingFunction<? super T, ? extends U, E> function); Lazy<U> flatMap(ThrowingFunction<? super T, Lazy<U>, E> function); }
Lazy { public T get() { return tryGet().orElseThrow(); } <E extends Exception> Lazy(ThrowingSupplier<T,E> supplier); Try<T> tryGet(); T get(); Optional<T> optional(); Stream<T> stream(); boolean isKnown(); boolean isKnownSuccess(); boolean isKnownFailure(); Lazy<U> map(ThrowingFunction<? super T, ? extends U, E> function); Lazy<U> flatMap(ThrowingFunction<? super T, Lazy<U>, E> function);  }