Utilize the forEach() method to output each entry in the map.
import public |
The forEach() method executes an action on each entry within the map. This action can be specified using a lambda expression that adheres to Java’s BiConsumer interface’s accept() method.
|
Parameter |
Description |
action |
Required: A BiConsumer object or lambda expression that carries out an action on an entry. The first parameter holds the entry’s key, and the second parameter holds its value. |