This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Getting maps from maps... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Getting maps from maps..." Watch "Getting maps from maps..." New topic
Author

Getting maps from maps...

John Brookes
Greenhorn

Joined: Feb 26, 2004
Posts: 29
I've been staring at this problem for about 2 hours so far and I'm not getting anywhere. I've got a 3-tiered map/object collection (based on cars and their accessories). It goes something like this - you can specify a model of car (M3 deluxe or whatever) which is used as the first key, and this kinks you to the categories of choices you can make - engine, colour, etc. Each category is another map linking to the specific item (for engine it's 1.0l, 1.4l, 1.5TD or whatever). I can retrieve a set of possible categories for a given model, but I can't get a map of categories so I can generate a set of individual items for a given category.
Any tips? If I've missed anything let me know - the skeleton code is here: http://www.co.umist.ac.uk/~wjb/ct122/lab/PhaseISkeleton/ but I'm not sure if it's available outside our network.
Thanks,
JB
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
You only have three maps, this is not enough. You need :
a top level Map that maps Model -> CategoryMap
Each CategoryMap should map Category -> A Set of specific items.
does that make sense ?
D.
[ February 26, 2004: Message edited by: Don Kiddick ]
John Brookes
Greenhorn

Joined: Feb 26, 2004
Posts: 29
I don't make the maps, I just pull stuff out of them
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
I'm unsure what your problem is then. Please can you post some code where you are having difficulties.
 
 
subject: Getting maps from maps...
 
Similar Threads
calling a function from inside another function
How to test more difficult input data like images?
is this lock&unlock ok?
Can we use jsp stuff in onklick events
Anyone tried Sun's "official Java courses"?