• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OOP 4 - Lookup

 
Amber Woods
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been working on my code for OOP 4 - Lookup Assignment but my code comes to 150 lines as opposed to the instructors of 120.
First in main, I create all of my objects: Videos, Books On Tape, and Furniture. Then I create the hashmap and use put for each object I created.
Is there and easier way to create the Hashmap other than having one put line for each object I created? I feel like there is a better way to do this and I am just not seeing it.
Any Suggestion?
Amber
[This message has been edited by Amber Woods (edited May 23, 2001).]
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the best way to initialize your HashMap. Don't worry too much about the length of the code. Concentrate on making your code as readable as possible.
 
Amber Woods
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marilyn
Amber
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic