This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections Frame work

 
Laxmi Bhavisetti
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the above program, when im trying to compile. The error im facing is Cannot find symbol ( Set<Map.Entry<String, Double>> set = hm.entrySet();
// Display the set
for(Map.Entry<String, Double> me : set):
Symbol is: class Entry
Location: class Map.

Can some one help me in this error.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48956
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compiled and ran first time when I tried it.
What version of javac are you using?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15282
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you maybe have a class that you wrote yourself that is called Entry or Map? It could be that the Java compiler is picking that up instead of the class Entry or Map from the package java.util.

Make sure that you remove any class named Entry or Map that you might have in your project.
 
Laxmi Bhavisetti
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesper,

Well i even tried to copy the program file on desktop and compile it. Its still showing the same error. Well Im working on different programs not on project. Learning java from complete reference to java book. As far i searched for class on those names, there are no programs specified with that name.

Hi campbell
The version of java im using is latest JRE 7
 
Laxmi Bhavisetti
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you jesper,
ive Got it. I took all my applications to other file and tried to execute this. IT worked thank you
 
Campbell Ritchie
Sheriff
Pie
Posts: 48956
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must have another class called Map.Entry or similar somewhere in your folder.
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only another class named Map. The error says it can find Map, but there's no nested class Entry inside Map.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48956
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you read the error message better than me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic