This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Map<String, Int> keyset not working 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 "Map<String, Int> keyset not working" Watch "Map<String, Int> keyset not working" New topic
Author

Map<String, Int> keyset not working

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495



Since the keys are Strings, what is the problem? How do I fix this?

Thanks,
John Price


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

john price wrote:Since the keys are Strings, what is the problem? How do I fix this?


What the keys are has nothing to do with that error message, which simply says that you've tried to use a method which doesn't exist. You fix it by changing "keyset" to the name of a method which does exist. Check the API documentation for java.util.Map to find one.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

Hint: it has nothing to do with types.

{Bah! Beat by 30 seconds!}


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Stupid me! Thank you!

For anyone who is wondering, it is keySet

John Price
 
I agree. Here's the link: jrebel
 
subject: Map<String, Int> keyset not working
 
Similar Threads
retrieving keys with a map interator
Method Hash
HashMap Problem
comparing keys of two hashmaps
Effective Java - Item 5 : Avoid creating unneccessary objects