mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Use some Java 8 features in commit log code
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=190985373
This commit is contained in:
parent
c40eda3235
commit
54a8cd09ea
2 changed files with 8 additions and 9 deletions
|
@ -116,13 +116,12 @@ class CommitLogCheckpointStrategy {
|
|||
ImmutableMap<Integer, DateTime> readBucketTimestamps() {
|
||||
// Use a fresh session cache so that we get the latest data from Datastore.
|
||||
return ofy.doWithFreshSessionCache(
|
||||
() -> {
|
||||
ImmutableMap.Builder<Integer, DateTime> results = new ImmutableMap.Builder<>();
|
||||
for (CommitLogBucket bucket : CommitLogBucket.loadAllBuckets()) {
|
||||
results.put(bucket.getBucketNum(), bucket.getLastWrittenTime());
|
||||
}
|
||||
return results.build();
|
||||
});
|
||||
() ->
|
||||
CommitLogBucket.loadAllBuckets()
|
||||
.stream()
|
||||
.collect(
|
||||
ImmutableMap.toImmutableMap(
|
||||
CommitLogBucket::getBucketNum, CommitLogBucket::getLastWrittenTime)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue