private static Position topicPartitionMapToPosition(final Map<TopicPartition, Long> topicPartitions) {
        final Map<String, Map<Integer, Long>> pos = new HashMap<>();
        for (final Entry<TopicPartition, Long> e : topicPartitions.entrySet()) {
            pos
                .computeIfAbsent(e.getKey().topic(), t -> new HashMap<>())
                .put(e.getKey().partition(), e.getValue());
        }
        return Position.fromMap(pos);
    }
a utility interface to facilitate stores' query dispatch logic,
allowing them to generically store query execution logic as the values
in a map.
streams/src/main/java/org/apache/kafka/streams/state/internals/StoreQueryUtils.java