class Suppliers {

    public static <T> Lazy<T> lazySingleton( final Supplier<T> supplier )
    {
        return new Lazy<T>()
        {
            volatile T instance;

            @Override
            public T get()
            {
                if ( isInitialised() )
                {
                    return instance;
                }

                synchronized ( this )
                {
                    if ( instance == null )
                    {
                        instance = supplier.get();
                    }
                }
                return instance;
            }

            @Override
            public boolean isInitialised()
            {
                return instance != null;
            }
        };
    }

    private  Suppliers();

}