Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry  RSS feed

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



this code above is giving me error --- java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry
strTo is a HashMap<String,String>
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Map.keySet returns a Set of all the keys in the Map.
If you want a Set of the key/value pairs in the map, use Map.entrySet();
 
divya kundapur
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Joanne Neal wrote:Map.keySet returns a Set of all the keys in the Map.
If you want a Set of the key/value pairs in the map, use Map.entrySet();



Thank You,
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!