/** * Creates a new {@link Lazy} to produce an object lazily. * * @param <T> the type of which to produce an object of eventually. * @param supplier the {@link Supplier} to create the object lazily. * @return */ public static <T> Lazy<T> of(Supplier<? extends T> supplier) { return new Lazy<>(supplier); }
/** * Creates a new {@link Lazy} to return the given value. * * @param <T> the type of the value to return eventually. * @param value the value to return. * @return */ public static <T> Lazy<T> of(T value) { Assert.notNull(value, "Value must not be null!"); return new Lazy<>(() -> value); }