21
diff --git a/src/main/java/com/github/glitchruk/tinytools/concurrent/Lazy.java b/src/main/java/com/github/glitchruk/tinytools/concurrent/Late.java
similarity index 86%
rename from src/main/java/com/github/glitchruk/tinytools/concurrent/Lazy.java
rename to src/main/java/com/github/glitchruk/tinytools/concurrent/Late.java
index 5a5ed84..83b28ab 100644
--- a/src/main/java/com/github/glitchruk/tinytools/concurrent/Lazy.java
+++ b/src/main/java/com/github/glitchruk/tinytools/concurrent/Late.java
@@ -18,13 +18,13 @@
*/
/**
- * A thread-safe utility class for lazy initialization.
+ * A thread-safe utility class for late initialization.
*
- * The {@code Lazy} class provides a mechanism for deferred initialization
+ * The {@code Late} class provides a mechanism for deferred initialization
* of an object. The value is set only once and can then be accessed multiple times.
* This is particularly useful in scenarios where an expensive computation or
- * initialization should be postponed until the first access, while maintaining
- * thread safety and ensuring efficient subsequent reads.
+ * initialization should only be performed once, while maintaining thread safety
+ * and ensuring efficient subsequent reads.
*
*
* Key Features:
@@ -54,7 +54,7 @@
* Example Usage:
* {@code
* public final class Person {
- * private final Lazy age = new Lazy<>();
+ * private final Late age = new Late<>();
*
* public Person() {
* // Constructor does not set age; it will be initialized later
@@ -79,16 +79,16 @@
* }
* }
*
- * @param the type of the value to be lazily initialized
+ * @param the type of the value to be initialized late
*/
-public class Lazy {
+public class Late {
private T value;
private boolean initialized;
/**
- * Creates a new {@code Lazy} instance with no initial value.
+ * Creates a new {@code Late} instance with no initial value.
*/
- public Lazy() {
+ public Late() {
this.value = null;
this.initialized = false;
}
@@ -101,7 +101,7 @@ public Lazy() {
*/
public synchronized void set(final T value) {
if (initialized) {
- throw new IllegalStateException("Lazy value already initialized");
+ throw new IllegalStateException("Late value already initialized");
}
this.value = value;
this.initialized = true;
@@ -115,7 +115,7 @@ public synchronized void set(final T value) {
*/
public synchronized T get() {
if (!initialized) {
- throw new IllegalStateException("Lazy value not initialized");
+ throw new IllegalStateException("Late value not initialized");
}
return value;
}