mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VolatileNNLazyValue, AtomicNNLazyValue <: NNLazyValue
This commit is contained in:
@@ -21,13 +21,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class AtomicNotNullLazyValue<T> {
|
||||
public abstract class AtomicNotNullLazyValue<T> extends NotNullLazyValue<T> {
|
||||
|
||||
private volatile T myValue;
|
||||
|
||||
@NotNull
|
||||
protected abstract T compute();
|
||||
|
||||
@NotNull
|
||||
public final T getValue() {
|
||||
if (myValue != null) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class NotNullLazyValue<T> {
|
||||
protected abstract T compute();
|
||||
|
||||
@NotNull
|
||||
public final T getValue() {
|
||||
public T getValue() {
|
||||
if (!myComputed) {
|
||||
myValue = compute();
|
||||
myComputed = true;
|
||||
|
||||
@@ -21,13 +21,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class VolatileNotNullLazyValue<T> {
|
||||
public abstract class VolatileNotNullLazyValue<T> extends NotNullLazyValue<T> {
|
||||
|
||||
private volatile T myValue;
|
||||
|
||||
@NotNull
|
||||
protected abstract T compute();
|
||||
|
||||
@NotNull
|
||||
public final T getValue() {
|
||||
T value = myValue;
|
||||
|
||||
Reference in New Issue
Block a user