Skip to content

Instantly share code, notes, and snippets.

@ananthchelladurai
Last active January 3, 2016 22:59

Revisions

  1. ananthchelladurai revised this gist Jan 21, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions SingletonBillPughExample.java
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ private SingletonBillPughExample() {
    // private constructor
    }

    private static class LazyHolder {
    private static class SingletonHolder {
    private static final SingletonBillPughExample INSTANCE = new SingletonBillPughExample();
    }

    public static BillPughSingleton getInstance() {
    return LazyHolder.INSTANCE;
    public static SingletonHolder getInstance() {
    return SingletonHolder.INSTANCE;
    }
    }
  2. ananthchelladurai created this gist Jan 21, 2014.
    14 changes: 14 additions & 0 deletions SingletonBillPughExample.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    public class SingletonBillPughExample {

    private SingletonBillPughExample() {
    // private constructor
    }

    private static class LazyHolder {
    private static final SingletonBillPughExample INSTANCE = new SingletonBillPughExample();
    }

    public static BillPughSingleton getInstance() {
    return LazyHolder.INSTANCE;
    }
    }