Skip to content

Commit

Permalink
Добавлен метод прямого получения значения
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Jul 17, 2020
1 parent 4034e83 commit f13b574
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/github/_1c_syntax/utils/Lazy.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public Lazy(Supplier<T> supplier, ReentrantLock lock) {
this.lock = lock;
}

public T get() {
return value;
}

public T getOrCompute(Supplier<T> supplier) {
final T result = value; // Just one volatile read
if (result == null) {
Expand Down

0 comments on commit f13b574

Please sign in to comment.