Ist das erlaubt oder schreit es nach Exception?
Java:
for (Map.Entry<String, Long> entry : mappingUuidAndTsOfHeartbeat.entrySet()) {
String uuid = entry.getKey();
Long tsOfHeartbeat = entry.getValue();
long diffInMilliseconds = now - tsOfHeartbeat;
if (diffInMilliseconds > ttl) {
mappingUuidAndTsOfHeartbeat.remove(uuid);
}
}