This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
Hello All, I am in a process of writing a java program which queries a database. I am retreiving all kinds of information and then I have to display it as a report. My concern is that that I have to make a HashMap inside a HashMap. What I mean is HashMap1 ------------- Keys | Values -------------- Unique| HashMap2 Unique| HashMap3 . . . . The HashMap2 also have there unique keys and values. Is there a better solution than the soln I presented?? Thanks in advance for your help! -Amish
Unless you need to be able to access the key Set or value Collection for the maps, this is equivalent to a single Map keyed by the composite of the two keys in your example (i.e. the composite of Hashmap1Key and Hashmap2Key, etc). One way to create composite keys isAlternatively, if your keys are Strings you might come up with a unique way to concatenate them, etc. - Peter
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
It pretty much depends on how much time you can put on this project and what the future needs are. You can use javabeans to represent a record in your database. It can give you type safety. It will take less memory than using a hashtable for each record, it can be crucial if you are retrieving a lot of data. Rather than having a hastable represent the results from a table, you can use a broker. The immidiate benefit is, you can use lazy data retrieval, which can be important for large amount of data. Another good thing about using this type of design is, you are open to use other features in future, like client side caching and bluh bluh bluh. But of course, this is not as important if no one will ever need to enhance this program ever.
tobe bondhu nouka bherao<br />shonabo gaan aj shara raat
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
a bit of art, as a gift, the permaculture playing cards