fork(1) download
  1. import java.util.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args){
  5. Map<String, String> map = new HashMap(){{
  6. put("key1", "valor1");
  7. put("key2", "valor2");
  8. put("key3", "valor3");
  9. }};
  10.  
  11. map.forEach((key, value) -> {
  12. System.out.println("chave: " + key + ", valor: " + value);
  13. });
  14. }
  15. }
Success #stdin #stdout 0.08s 711168KB
stdin
Standard input is empty
stdout
chave: key1, valor: valor1
chave: key2, valor: valor2
chave: key3, valor: valor3