How Singleton pattern with Early Initialization vs Lazy Loading in Apex differs? - Salesforce Stack Exchange
Tue May 16 2023 11:46:02 GMT+0000 (Coordinated Universal Time)
Saved by
@hurrand
public with sharing class EagerInitializedSingleton {
//private static instance of the class
private static final EagerInitializedSingleton instance = new EagerInitializedSingleton();
//private constructor to avoid creating an instance anywhere outside of this class
private EagerInitializedSingleton(){}
public static EagerInitializedSingleton getInstance(){
return instance;
}
content_copyCOPY
Singleton Easy
https://salesforce.stackexchange.com/questions/391882/how-singleton-pattern-with-early-initialization-vs-lazy-loading-in-apex-differs
Comments