ensureHistory() boils down to a simple computeIfAbsent(),
so make it more concise by using a simple constructor lambda.
Change-Id: Ia093ced071ae5e0411633d3c4f501a4e94c5de43
Signed-off-by: Robert Varga <rovarga@cisco.com>
}
private FrontendHistoryMetadataBuilder ensureHistory(final LocalHistoryIdentifier historyId) {
- final FrontendHistoryMetadataBuilder existing = currentHistories.get(historyId);
- if (existing != null) {
- return existing;
- }
-
- final FrontendHistoryMetadataBuilder ret = new FrontendHistoryMetadataBuilder(historyId);
- currentHistories.put(historyId, ret);
- return ret;
+ return currentHistories.computeIfAbsent(historyId, FrontendHistoryMetadataBuilder::new);
}
}