mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Simplification of NotNullLazyValue.
This commit is contained in:
@@ -23,17 +23,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class NotNullLazyValue<T> {
|
||||
private boolean myComputed;
|
||||
@NotNull private T myValue;
|
||||
private T myValue;
|
||||
|
||||
@NotNull
|
||||
protected abstract T compute();
|
||||
|
||||
@NotNull
|
||||
public T getValue() {
|
||||
if (!myComputed) {
|
||||
if (myValue == null) {
|
||||
myValue = compute();
|
||||
myComputed = true;
|
||||
}
|
||||
return myValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user