mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add AtomicNullableLazyValue.createValue(Factory)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.intellij.openapi.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -46,4 +49,16 @@ public abstract class AtomicNullableLazyValue<T> extends NullableLazyValue<T> {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
|
||||
@NotNull
|
||||
public static <T> AtomicNullableLazyValue<T> createValue(@NotNull final Factory<T> value) {
|
||||
return new AtomicNullableLazyValue<T>() {
|
||||
@Nullable
|
||||
@Override
|
||||
protected T compute() {
|
||||
return value.create();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user