23 lines
376 B
Java
Raw Normal View History

package com.iluwatar.lazy.loading;
2015-04-10 20:24:16 +03:00
/**
*
* Simple implementation of the lazy loading idiom. However, this is not thread safe.
2015-04-10 20:24:16 +03:00
*
*/
public class HolderNaive {
private Heavy heavy;
public HolderNaive() {
System.out.println("HolderNaive created");
}
public Heavy getHeavy() {
if (heavy == null) {
heavy = new Heavy();
}
return heavy;
}
2015-04-10 20:24:16 +03:00
}