On Thursday, November 15, 2012 6:37:16 PM UTC-5, Jan Kotek wrote:
>, but when I retrieve one of the nested maps (in the same thread that
I created them), they are empty
I guess you should put(store) submap AFTER you update it not BEFORE.
This seems a little unexpected to me, as it differs from how java.util.HashMap would behave. Would this occur if I was using the transaction functionality?
> Without the nesting I think I would have to iterate over all the keys
Use SortedMap submaps (tailMap,headMap) to only query interval you are
interested in.
good to know, I wasn't even aware of the tailMap, headMap methods :) I assume that this would require the key structure to be regular in order to use this, though. In my case, my key tuple would consist of Tuple<String,Long,Long,String>, where the last String would map to a column in the row that will be created. I may not have values in the map for each column (in which case I am currently inserting a zero in the column), so in order to use the SortedMap, I think I would need to have these populated with zero values, so that I could consistently iterate over all of the column keys.
> It would probably make more sense to use some kind of embedded db or
kv store.
Give a try to H2 database. It is surprisingly easy and intuitive.
Thanks for the tip, that is exactly what I am going to try