8000 #403, updated javadocs · mryba/java-design-patterns@59cf100 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 59cf100

Browse files
committed
iluwatar#403, updated javadocs
1 parent ad11ea4 commit 59cf100

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

promise/src/main/java/com/iluwatar/promise/Promise.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public <V> Promise<V> thenApply(Function<? super T, V> func) {
139139
}
140140

141141
/**
142-
* A consume action provides the action, the value from source promise and fulfills the
142+
* Accesses the value from source promise and calls the consumer, then fulfills the
143143
* destination promise.
144144
*/
145145
private class ConsumeAction implements Runnable {
@@ -166,8 +166,8 @@ public void run() {
166166
}
167167

168168
/**
169-
* A function action provides transformation function, value from source promise and fulfills the
170-
* destination promise with the transformed value.
169+
* Accesses the value from source promise, then fulfills the destination promise using the
170+
* transformed value. The source value is transformed using the transformation function.
171171
*/
172172
private class TransformAction<V> implements Runnable {
173173

@@ -184,8 +184,7 @@ private TransformAction(Promise<T> src, Promise<V> dest, Function<? super T, V>
184184
@Override
185185
public void run() {
186186
try {
187-
V result = func.apply(src.get());
188-
dest.fulfill(result);
187+
dest.fulfill(func.apply(src.get()));
189188
} catch (Throwable throwable) {
190189
dest.fulfillExceptionally((Exception) throwable.getCause());
191190
}

0 commit comments

Comments
 (0)
0