New method #isSet() in Lazy and LazyOrException class
This commit is contained in:
parent
84298b08b3
commit
463a4d7e78
@ -56,4 +56,13 @@ public class Lazy<T> implements Supplier<T> {
|
|||||||
cached = true;
|
cached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells if the value is currently set or not.
|
||||||
|
* @return true if the value has been set by calling the method {@link #get()} or {@link #set(Object)} but not yet
|
||||||
|
* reset by {@link #reset()}, or false otherwise.
|
||||||
|
*/
|
||||||
|
public synchronized boolean isSet() {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,13 @@ public class LazyOrException<T, E extends Exception> implements SupplierExceptio
|
|||||||
cached = true;
|
cached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells if the value is currently set or not.
|
||||||
|
* @return true if the value has been set by calling the method {@link #get()} or {@link #set(Object)} but not yet
|
||||||
|
* reset by {@link #reset()}, or false otherwise.
|
||||||
|
*/
|
||||||
|
public synchronized boolean isSet() {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user