This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Map map = new Hashmap()

 
yamini nadella
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume Map interface has 10 public methods. Hashmap class implemented Map interface and some extra methods, total 20 public methods.
Map map = new Hashmap()
From this map object how many methods can I access. Can I access 10 or 20?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only access the 10 methods of Map through the reference map.
You would, in your example, have to cast the reference map to a HashMap reference if you wanted to access all of HashMap's methods.
For instance: ((HashMap)map).someMethodSpecificToHashMap()
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic