This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup GitHub issue labels script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Supplier; | |
public class CachedObject<T> { | |
private final Supplier<T> updateFunction; | |
private T cachedValue; | |
private boolean dirty = true; | |
public CachedObject(Supplier<T> updateFunction) { | |
this.updateFunction = updateFunction; | |
} |