steveniemitz commented on a change in pull request #13802:
URL: https://github.com/apache/beam/pull/13802#discussion_r564985266
##########
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:
wdyt about replacing this with either `computeIfAbsent` or
`getOrDefault(K key, Supplier<V> defaultValue)`?
Either would allow users to avoid allocating throw-away defaultValues for
every `getOrDefault` operation.
----------------------------------------------------------------
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]