Java 8:
You Method forEach is more concise (like mentioned in the comments), however you can still use Java Stream API with a lambda expressions:expression like below,
myMap.entrySet().stream().forEach((entry) -> {
Object currentKey = entry.getKey();
Object currentValue = entry.getValue();
});
For more information, follow this.