Source:
<code>private <T> ListenableFuture<Collection<Map.Entry<Cell, T>>> getWithPostFilteringAsync( TableReference tableRef, Map<Cell, Value> rawResults, Function<Value, T> transformer, AsyncKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { long bytes = 0; for (Map.Entry<Cell, Value> entry : rawResults.entrySet()) { bytes += entry.getValue().getContents().length + Cells.getApproxSizeOfCell(entry.getKey()); } if (bytes > TransactionConstants.WARN_LEVEL_FOR_QUEUED_BYTES && log.isWarnEnabled()) { log.warn("A single get had quite a few bytes: for table {}. The number of results was {}. " + "Enable debug logging for more information.", SafeArg.of("numBytes", bytes), LoggingArgs.tableRef(tableRef), SafeArg.of("numResults", rawResults.size())); if (log.isDebugEnabled()) { log.debug("The first 10 results of your request were {}.", UnsafeArg.of("results", Iterables.limit(rawResults.entrySet(), 10)), new SafeRuntimeException("This exception and stack trace are provided for debugging purposes")); } getHistogram(AtlasDbMetricNames.SNAPSHOT_TRANSACTION_TOO_MANY_BYTES_READ, tableRef).update(bytes); } getMeter(AtlasDbMetricNames.SNAPSHOT_TRANSACTION_CELLS_READ, tableRef).mark(rawResults.size()); Collection<Map.Entry<Cell, T>> resultsAccumulator = new LinkedList<>(); if (AtlasDbConstants.HIDDEN_TABLES.contains(tableRef)) { Preconditions.checkState(allowHiddenTableAccess, "hidden tables cannot be read in this transaction"); for (Map.Entry<Cell, Value> e : rawResults.entrySet()) { resultsAccumulator.add( <START> new AbstractMap.SimpleImmutableEntry<>(e.getKey(), transformer.apply(e.getValue()))); <END> } return Futures.immediateFuture(resultsAccumulator); } AtomicInteger resultCount = new AtomicInteger(); return Futures.transformAsync( Futures.immediateFuture(rawResults), remainingResultsToPostFilter -> getWithPostFilteringIterate(tableRef, remainingResultsToPostFilter, resultCount, resultsAccumulator, transformer, asyncKeyValueService, asyncTransactionService), MoreExecutors.directExecutor()); }</code><technical_language>nit: Maps.immutableEntry()</technical_language>

Target:
private <T> ListenableFuture<Collection<Map.Entry<Cell, T>>> getWithPostFilteringAsync( TableReference tableRef, Map<Cell, Value> rawResults, Function<Value, T> transformer, AsyncKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { long bytes = 0; for (Map.Entry<Cell, Value> entry : rawResults.entrySet()) { bytes += entry.getValue().getContents().length + Cells.getApproxSizeOfCell(entry.getKey()); } if (bytes > TransactionConstants.WARN_LEVEL_FOR_QUEUED_BYTES && log.isWarnEnabled()) { log.warn("A single get had quite a few bytes: for table {}. The number of results was {}. " + "Enable debug logging for more information.", SafeArg.of("numBytes", bytes), LoggingArgs.tableRef(tableRef), SafeArg.of("numResults", rawResults.size())); if (log.isDebugEnabled()) { log.debug("The first 10 results of your request were {}.", UnsafeArg.of("results", Iterables.limit(rawResults.entrySet(), 10)), new SafeRuntimeException("This exception and stack trace are provided for debugging purposes")); } getHistogram(AtlasDbMetricNames.SNAPSHOT_TRANSACTION_TOO_MANY_BYTES_READ, tableRef).update(bytes); } getMeter(AtlasDbMetricNames.SNAPSHOT_TRANSACTION_CELLS_READ, tableRef).mark(rawResults.size()); Collection<Map.Entry<Cell, T>> resultsAccumulator = new LinkedList<>(); if (AtlasDbConstants.HIDDEN_TABLES.contains(tableRef)) { Preconditions.checkState(allowHiddenTableAccess, "hidden tables cannot be read in this transaction"); for (Map.Entry<Cell, Value> e : rawResults.entrySet()) { resultsAccumulator.add( Maps.immutableEntry(e.getKey(), transformer.apply(e.getValue()))); } return Futures.immediateFuture(resultsAccumulator); } return Futures.transformAsync( Futures.immediateFuture(rawResults), remainingResultsToPostFilter -> getWithPostFilteringIterate(tableRef, remainingResultsToPostFilter, resultsAccumulator, transformer, asyncKeyValueService, asyncTransactionService), MoreExecutors.directExecutor()); }