diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java index 2dff568f4..5e3ff9e35 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java @@ -98,7 +98,7 @@ public class Memoizer implements Computable { *

*

* This cache will also cache exceptions that occur during the computation - * if the {@code recalculate} parameter is the constructor was set to + * if the {@code recalculate} parameter in the constructor was set to * {@code false}, or not set. Otherwise, if an exception happened on the * previous calculation, the method will attempt again to generate a value. *

@@ -112,7 +112,7 @@ public class Memoizer implements Computable { @Override public O compute(final I arg) throws InterruptedException { while (true) { - Future future = cache.get(arg); + Future future = cache.computeIfAbsent(arg, k->{return null;}); if (future == null) { final FutureTask futureTask = new FutureTask<>(() -> computable.compute(arg)); future = cache.putIfAbsent(arg, futureTask);