Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

meaning pf this code

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static class Entry implements Map.Entry {


/*********** can anyone explain this thing ****/

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the definition of an inner class (since top-level classes can't be declared static) called "Entry" that implements the interface Map.Entry.

What are you unsure about? Map.Entry is defined in the JavaDocs , do you not understand what this interface is for? Or are you unfamiliar with inner classes?
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static class Entry implements Map.Entry {


if it was static class Entry implements Map i understand

what i am not getting is Map.Entry ?
which is the interface here Map or Entry?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The interface is Map.Entry. It is an interface defined in the Map class hence the slightly unusual form.
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi paul,

sorry if i sound silly but i thought Map was a interface?
 
shazar kv
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Map is an Interface NOT a class defined in java.util package.Map.Entry is another Interface defined in the same package.

Map interface contains a method called entrySet() - Returns a set view of the mappings contained in this map..The return type of the method is Map.Entry.

The Map.entrySet method returns a collection-view of the map, whose elements are of this interface(Map.Entry)

Regards
Shazar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic