@Test public void test1() { Solution a = Solution.getInstance(); Solution b = Solution.getInstance(); assertSame(a,b); }
public static Solution getInstance() { if (null == solution) { synchronized (lock) { if (null == solution) { solution = new Solution(); } } } return solution; }
Solution { public static Solution getInstance() { if (null == solution) { synchronized (lock) { if (null == solution) { solution = new Solution(); } } } return solution; } }
Solution { public static Solution getInstance() { if (null == solution) { synchronized (lock) { if (null == solution) { solution = new Solution(); } } } return solution; } private  Solution(); }
Solution { public static Solution getInstance() { if (null == solution) { synchronized (lock) { if (null == solution) { solution = new Solution(); } } } return solution; } private  Solution(); static Solution getInstance(); }
Solution { public static Solution getInstance() { if (null == solution) { synchronized (lock) { if (null == solution) { solution = new Solution(); } } } return solution; } private  Solution(); static Solution getInstance();  }