reuvenlax commented on a change in pull request #13802:
URL: https://github.com/apache/beam/pull/13802#discussion_r565028572
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/state/MapState.java
##########
@@ -77,6 +84,17 @@
*/
ReadableState<V> get(K key);
+ /**
+ * A deferred lookup.
+ *
+ * <p>A user is encouraged to call {@code get} for all relevant keys and
call {@code readLater()}
+ * on the results.
+ *
+ * <p>When {@code read()} is called, a particular state implementation is
encouraged to perform
+ * all pending reads in a single batch.
+ */
+ ReadableState<V> getOrDefault(K key, @Nullable V defaultValue);
Review comment:
Adding computeIfAbsent is a good idea - just added it.
while computeIfAbsent is a generalization off putIfAbsent, it's not quite a
generalization of getOrDefault, since getOrDefault doesn't modify the map.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]