https://linktr.ee/mcasari
Web site: https://codingstrain.com
public class MainClass {
private HeavyClass heavyObj;
//instead of creating it in the constructor
public HeavyClass getHeavyObj() {
if (heavyObj == null) {
heavyObj = new HeavyClass();
}
return heavyObj;
}
}
#Java #Performance
public class MainClass {
private HeavyClass heavyObj;
//instead of creating it in the constructor
public HeavyClass getHeavyObj() {
if (heavyObj == null) {
heavyObj = new HeavyClass();
}
return heavyObj;
}
}
#Java #Performance
public class Config {
...
public static String getConfigPath() {
return configPath;
}
}
The configuration path is shared globally, and changing it in one place could affect others.
#Java
public class Config {
...
public static String getConfigPath() {
return configPath;
}
}
The configuration path is shared globally, and changing it in one place could affect others.
#Java
private static final List
Some parts of the code may keep adding elements without removing them, eventually leading to memory exhaustion.
#Java #MemoryManagement
private static final List
Some parts of the code may keep adding elements without removing them, eventually leading to memory exhaustion.
#Java #MemoryManagement