Class LazyInit<T>

java.lang.Object
de.arstwo.twotil.LazyInit<T>
All Implemented Interfaces:
Supplier<T>

public class LazyInit<T> extends Object implements Supplier<T>
Initializes something on the first use.

Confirmation of initialization is done by replacing the accessor function. This way the JIT can easily determine that the resulting accessor is empty boilerplate that can be inlined.

  • Constructor Details

    • LazyInit

      public LazyInit(Supplier<T> initializer)
  • Method Details

    • get

      public T get()
      Specified by:
      get in interface Supplier<T>