File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes OOP 4 - Lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "OOP 4 - Lookup" Watch "OOP 4 - Lookup" New topic

OOP 4 - Lookup

Amber Woods
Ranch Hand

Joined: Mar 28, 2001
Posts: 111
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?
[This message has been edited by Amber Woods (edited May 23, 2001).]

"Happiness is a way to Travel, <b>Not</b> a Destination" -- Unknown
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
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.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Amber Woods
Ranch Hand

Joined: Mar 28, 2001
Posts: 111
Thanks Marilyn
jQuery in Action, 3rd edition
subject: OOP 4 - Lookup
It's not a secret anymore!