Meaningless Drivel is fun!*
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
Author

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?
Amber
[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
Sheriff

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

JavaBeginnersFaq
"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
Amber
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OOP 4 - Lookup
 
Similar Threads
HashMap Help
OOP-4 clarification
instructors solution for OOP-4
OOP-4 hints please.
STRUTS:getting count from database when a value in select box is changed