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

I want to know how to use methods furnished below in this program???

 
Aashiq Firnaz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Sheriff
Pie
Posts: 47244
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Your question is not clear. You can use the methods by calling them on an instance of your MapInterfaceExample class. But they do nothing useful.

Do you mean how would you implement them?
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be warned, your current implementation of put will lead to a StackOverflowError. When you call put, it calls put, which calls put, which calls put, etc.
 
Aashiq Firnaz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes Mr Campbell i want to know how to implement them!!!
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12017
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
personally, i would comment all of them out but one, and implement it first. implement it, test it, test it some more, then test it again. Note that when testing, you often have to write 'throw-away' code - code that is used ONLY for testing, but won't then be in your final program.

Which method you do first is sort of dependent on a few things. You can't really test your clear() method if there is nothing in the collection, so it doesn't make sense to implement it first...and Rob is right - your put() method has problems.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic