I'm studying basic software design pattern. 

The basic implementation of singleton classes are written like this:

```
    public class MyObject{

       private volatile static MyObject obj;

       private MyObject(){/*Do some heavy stuff here*/}

       public static synchronized MyObject getInstance(){
         if(obj==null)
            obj=new MyObject();
         return obj;
       }    
    }

```

But as I have undestood calling synchronized methods can be heavy.

I while back I red a book the introduced this kind of implementation of Singleton class:

```
public class MyObjectHolder {

private volatile static Supplier<MyObject> myObjectSupplier = () -> createMyObj();
//myObjectSupplier is changed on the first 'get()' call

public static MyObject getMyObject(){
    return myObjectSupplier.get();
}

private static synchronized MyObject createMyObj(){
    class MyObjectFactory implements Supplier<MyObject> {
        private final MyObject clockTimer = new MyObject();
        public MyObject get() { return clockTimer; }
    }

    if(!MyObjectFactory.class.isInstance(myObjectSupplier)) {
        myObjectSupplier = new MyObjectFactory();
    }
    return myObjectSupplier.get();
}

public static class MyObject{

    private MyObject(){
        /*Do some heavy stuff here*/
    }

    public void someMethod(){
        /* ... */
    }
}

}

...   

    {
        /*In main MyObject instantiation*/
        MyObjectHolder.MyObject obj = MyObjectHolder.getMyObject();

    }

```

Now after the first call for 'createMyObj()' has been has been finished, there is no heavy burden of synchronized method calling and the is no if check neither.

Do you think there is something wrong with this kind of implementation?

ps. MyObject does not have to be an inner class of MyObjectHold but I thought it looked nice.