And for each product, we need its price, quantity, location, etc. User can pick from the lists and I need to display tables for the products they pick and it has to be grouped at the "2-digit" code level, i.e make a table for "milk" followed a table for "bread", etc.
I think of using "Hashmap" and the key is the "2-digit" code (like 01, 02, 03), for each key, there is an Arraylist associated with it. e.g. for "01" the arraylist includes few elements, each element includes the "4-digit" code, price, quantity. So when I print the tables, I iterate through the keys, for each key, I create a table displaying the Arraylist.
Is this a good idea or do you have better suggestion ?
Joined: Mar 30, 2005
sounds like a good idea to me.
Joined: Apr 02, 2004
If your key contains just the code, how would you retrieve the big group name? from another look-up table?
How about having a POJO to have 2 instance variables: a String to contain the big group name & an ArrayList to contain elements.