# Class Lazy<T>

java.lang.Object
htsjdk.samtools.util.Lazy<T>

public class Lazy<T> extends Object
Simple utility for building an on-demand (lazy) object-initializer. Works by accepting an initializer describing how to build the on-demand object, which is only called once and only after the first invocation of `get()` (or it may not be called at all).

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`Lazy.LazyInitializer<T>`
Deprecated.
since 1/2017 use a `Supplier` instead

## Constructor Summary

Constructors
Constructor
Description
`Lazy(Supplier<T> initializer)`

## Method Summary

Modifier and Type
Method
Description
`T`
`get()`
Returns the instance associated with this `Lazy`, initializing it if necessary.
`boolean`
`isInitialized()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Lazy

public Lazy(Supplier<T> initializer)

## Method Details

### get

public T get()
Returns the instance associated with this `Lazy`, initializing it if necessary.

### isInitialized

public boolean isInitialized()