aspose file tools
The moose likes Java in General and the fly likes  java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark " java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry" Watch " java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry" New topic
Author

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

divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110



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>


SCJP - 5.0
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3011
    
    9
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();


Joanne
divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
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,
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry
 
Similar Threads
Iterator in Generics
ClasscastException in Collections.sort()
Generic Collections
Problem in Creating HashMap object then display in sorted and unsorted order
runtime exception during accessing elements in hashmap