public Optional<ProducerStateEntry> lastEntry(long producerId) {
        return Optional.ofNullable(producers.get(producerId));
    }
Get the last written entry for the given producer id.
storage/src/main/java/org/apache/kafka/storage/internals/log/ProducerStateManager.java