• Post Reply Bookmark Topic Watch Topic
  • New Topic

java 8 merge  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in java book about OCP exam it is said that :
when calling merge method on a map using a key which value is null and the mapping function returns null the key will be removed, however when I run the following code :

I get : {0=zero, 1=aa}
does anyone knows why ??
 
Marshal
Posts: 59438
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it say in the documentation for Map#merge()?
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!