For each row in the resultset: 1. convert the row to an Object; only you can decide how to do that 2. pick a key for that Object; only you know what key might be appropriate 3. insert the Object into the map using the key
You can easily imagine a result set as a grid, or maybe a spreadsheet. One way to get that feeling in memory is an array of arrays, or a more flexible collection of collections. You can make a totally generic solution like this:
Now when you consume this thing you can get all the column information from the first object in the master list, then get one row of data from each of the subsequent objects in the master list.
I've done this for some generic tools, but wouldn't do it for a system-wide architecture. I'd much prefer to make an object for each unique query / set of result columns.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi