LazyConstructable
Date: 2012-06-29

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.chromium.sdk.util
Class LazyConstructable<T>

    java.lang.Object
      org.chromium.sdk.util.LazyConstructable<T>

    public class LazyConstructable<T>

extends java.lang.Object

Holds a value yet-to-be-constructed. It gets constructed when method `get()` is called the first time. User must provide `LazyConstructable.Factory` that actually constructs the value. Once the value is constructed, the factory is released and may be collected by Java GC.

Threads: the class is thread-safe; how it's implementation is lock-free, so a factory may be called several times from several concurrent threads. However method `get()` is guaranteed to always return the same value from to whatever thread.

Nested Class Summary
`static interface` | `LazyConstructable.Factory<T>`

Constructor Summary
`LazyConstructable(LazyConstructable.Factory<T> factory)`

Method Summary
`static
`<T> LazyConstructable<T>`
` | `create(LazyConstructable.Factory<T> factory)`
`T` | `get()` Constructs a value when called first time and returns it to all subsequent calls.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LazyConstructable

    public LazyConstructable(LazyConstructable.Factory<T> factory)

Method Detail

### create

    public static <T> LazyConstructable<T> create(LazyConstructable.Factory<T> factory)

### get

    public T get()

  Constructs a value when called first time and returns it to all subsequent calls.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD