public static CosmosUpdateTimeFindToken getUpdatedToken(CosmosUpdateTimeFindToken prevToken,
      List<CloudBlobMetadata> queryResults) {
    if (queryResults.isEmpty()) {
      return prevToken;
    }

    Set<String> lastUpdateTimeReadBlobIds;
    long lastUpdateTime = queryResults.get(queryResults.size() - 1).getLastUpdateTime();
    if (lastUpdateTime == prevToken.getLastUpdateTime()) {
      // If last update time doesn't progress with the new token, then new token should include all the previous blobIds
      // with the same last update time.
      lastUpdateTimeReadBlobIds = new HashSet<>(prevToken.getLastUpdateTimeReadBlobIds());
    } else {
      lastUpdateTimeReadBlobIds = new HashSet<>();
    }

    for (int i = queryResults.size() - 1; i >= 0; i--) {
      if (queryResults.get(i).getLastUpdateTime() == lastUpdateTime) {
        lastUpdateTimeReadBlobIds.add(queryResults.get(i).getId());
      } else {
        break;
      }
    }

    long bytesReadThisQuery = queryResults.stream().mapToLong(CloudBlobMetadata::getSize).sum();
    return new CosmosUpdateTimeFindToken(lastUpdateTime, prevToken.getBytesRead() + bytesReadThisQuery,
        lastUpdateTimeReadBlobIds);
  }
Utility to construct a new CloudFindToken from a previous instance and the results of a findEntriesSince query.
@param prevToken previous {@link CosmosUpdateTimeFindToken}.
@param queryResults List of {@link CloudBlobMetadata} objects.
@return the updated token.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosUpdateTimeFindToken.java