Skip to content

Commit c6d0d28

Browse files
committed
Reverting initialization on demand holder idiom.
1 parent e262155 commit c6d0d28

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@ public final class IvoryTower {
3232
*/
3333
private IvoryTower() {}
3434

35-
private static class IvoryTowerHolder {
36-
/**
35+
/**
3736
* Static to class instance of the class.
3837
*/
39-
private static final IvoryTower INSTANCE = new IvoryTower();
40-
}
38+
private static final IvoryTower INSTANCE = new IvoryTower();
4139

4240
/**
4341
* To be called by user to obtain instance of the class.
4442
*
4543
* @return instance of the singleton.
4644
*/
4745
public static IvoryTower getInstance() {
48-
return IvoryTowerHolder.INSTANCE;
46+
return INSTANCE;
4947
}
5048
}

0 commit comments

Comments
 (0)