org.snapscript.common.LazyLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
package org.snapscript.common;
public class LazyLoader {
private LazyBuilder builder;
private V value;
public LazyLoader(LazyBuilder builder) {
this.builder = builder;
}
public V load(K key) {
if(value == null) {
value = builder.create(key);
}
return value;
}
}