Above, Below, and Beyond Tech Talk

by Rahel Lüthy

November 30, 2013

Guava Lazy Init

Note to self: How to lazily initialize a value with Java/Guava

private final Supplier<Integer> lazyValue = Suppliers.memoize(new Supplier<Integer>() { 
  public Integer get() {
    return 42;
  };
});