/** * Returns the partition for the given key. * * @param key the key for which to return the partition * @return the partition for the given key */ default Partition getPartition(String key) { int hashCode = Hashing.sha256().hashString(key, StandardCharsets.UTF_8).asInt(); return getPartition(getPartitionIds().get(Math.abs(hashCode) % getPartitionIds().size())); }