Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. Map<String, Double> map1 = new HashMap<>();
  2. Map<String, Double> map2 = new HashMap<>();
  3. Map<String, Double> map3 = new HashMap<>();
  4.  
  5. map1.put("clave1", 10.0);
  6. map1.put("clave2", 4.0);
  7. map2.put("clave1", 10.0);
  8. map2.put("clave2", 6.0);
  9.  
  10. map3= new HashMap(map1);
  11.  
  12. map2.forEach((key, value) -> map3.merge(key, value, (v1, v2) -> (v1+v2)/2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement