Singleton Pattern
From Logic Wiki
Video
https://www.youtube.com/watch?v=hUE_j6q0LTQ
Definition
Singleton pattern is a software design pattern that restricts the instantiation of a class to one. This is useful when exactly one object is needed to coordinate actions across the system. The term comes from the mathematical concept of a singleton.
Usage
class Singleton {
static private Singleton Instance
private Singleton(){}
public static Singleton getInstance(){
if(Instance == null){
Instance = new Singleton()
}
return Instance
}
}
<pre>
