Design Pattern: Singleton Pattern in Java
Singleton pattern is used to ensure that, only one instance of a class can be created. This article demonstrates Singleton pattern implementations in Java.
Singleton pattern is used to ensure that, only one instance of a class can be created. This article demonstrates Singleton pattern implementations in Java.
Factory pattern helps to generate object by choosing one class from a bunch of classes. The class is chosen by some predefined criteria. This article demonstrates Abstract Factory pattern implementations in Java.
Strategy pattern is used when there are multiple algorithms available for the same purpose, and we need to decide between those algorithms. Strategy pattern helps to decide the algorithm and return the generated object to be used. This article demonstrates Strategy pattern implementations in Java. Check the following examples.
Adapter pattern is used when an interface does not match the new requirement and the existing interface needs to adapt to another interface. This article demonstrates Adapter pattern implementations in Java.
Facade pattern is used to hide the complexity of underlying subsystems. A new layer is created as Facade, which works as an entry point for the client. This article demonstrates Facade pattern implementations in Java.
Flyweight pattern is used to reduce the number of objects to save memory and optimize resources. This article demonstrates Flyweight pattern implementations in Java. Check the following examples.
Decorator pattern is used to attach a new functionality to an existing object, without changing the existing class. This article demonstrates Decorator pattern implementations in Java.
Composite pattern is used to handle the operation of a bunch of classes (having the same interface), to operate the same function of all items a the same time. Using Composite pattern the client can ignore the difference between the Composition and Leaf classes, and can use the composition considering the same interface. This article demonstrates Composite pattern implementations in Java. Check the following examples.
Bridge pattern is used to decouple implementation and abstraction. This article demonstrates Bridge pattern implementations in Java.
Abstract Factory pattern is used to generate multiple factory generators. This article demonstrates Abstract Factory pattern implementations in Java.