Source:
<code>private void commitOffsetsForAckedTuples(Set<TopicPartition> assignedPartitions) { final Map<TopicPartition, OffsetManager> assignedOffsetManagers = offsetManagers.entrySet().stream() .filter(entry -> assignedPartitions.contains(entry.getKey())) <START> .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue())); <END> final Map<TopicPartition, OffsetAndMetadata> nextCommitOffsets = new HashMap<>(); for (Map.Entry<TopicPartition, OffsetManager> tpOffset : assignedOffsetManagers.entrySet()) { final OffsetAndMetadata nextCommitOffset = tpOffset.getValue().findNextCommitOffset(); if (nextCommitOffset != null) { nextCommitOffsets.put(tpOffset.getKey(), nextCommitOffset); } } if (!nextCommitOffsets.isEmpty()) { kafkaConsumer.commitSync(nextCommitOffsets); LOG.debug("Offsets successfully committed to Kafka [{}]", nextCommitOffsets); for (Map.Entry<TopicPartition, OffsetAndMetadata> tpOffset : nextCommitOffsets.entrySet()) { final TopicPartition tp = tpOffset.getKey(); long position = kafkaConsumer.position(tp); long committedOffset = tpOffset.getValue().offset(); if (position < committedOffset) { LOG.debug("Consumer fell behind committed offset. Catching up. Position was [{}], skipping to [{}]", position, committedOffset); kafkaConsumer.seek(tp, committedOffset); waitingToEmit = null; } final OffsetManager offsetManager = assignedOffsetManagers.get(tp); offsetManager.commit(tpOffset.getValue()); LOG.debug("[{}] uncommitted offsets for partition after commit", offsetManager.getNumUncommittedOffsets(), tp); } } else { LOG.trace("No offsets to commit. {}", this); } }</code><technical_language>method reference for key/value</technical_language>

Target:
private void commitOffsetsForAckedTuples(Set<TopicPartition> assignedPartitions) { final Map<TopicPartition, OffsetManager> assignedOffsetManagers = offsetManagers.entrySet().stream() .filter(entry -> assignedPartitions.contains(entry.getKey())) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); final Map<TopicPartition, OffsetAndMetadata> nextCommitOffsets = new HashMap<>(); for (Map.Entry<TopicPartition, OffsetManager> tpOffset : assignedOffsetManagers.entrySet()) { final OffsetAndMetadata nextCommitOffset = tpOffset.getValue().findNextCommitOffset(); if (nextCommitOffset != null) { nextCommitOffsets.put(tpOffset.getKey(), nextCommitOffset); } } if (!nextCommitOffsets.isEmpty()) { kafkaConsumer.commitSync(nextCommitOffsets); LOG.debug("Offsets successfully committed to Kafka [{}]", nextCommitOffsets); for (Map.Entry<TopicPartition, OffsetAndMetadata> tpOffset : nextCommitOffsets.entrySet()) { final TopicPartition tp = tpOffset.getKey(); long position = kafkaConsumer.position(tp); long committedOffset = tpOffset.getValue().offset(); if (position < committedOffset) { LOG.debug("Consumer fell behind committed offset. Catching up. Position was [{}], skipping to [{}]", position, committedOffset); kafkaConsumer.seek(tp, committedOffset); waitingToEmit = null; } final OffsetManager offsetManager = assignedOffsetManagers.get(tp); offsetManager.commit(tpOffset.getValue()); LOG.debug("[{}] uncommitted offsets for partition after commit", offsetManager.getNumUncommittedOffsets(), tp); } } else { LOG.trace("No offsets to commit. {}", this); } }