java - What would be an appropriate data-structure to store a 2D table structure in memory? -
i have 2d table structure reading underlying database, , wondering, best in-memory data-structure use store into. where, can accessible further reading, manipulation, etc.
i maps of maps like
map<string, map<string,string>> table = new hashmap<string, map<string,string>>();
here example
column_a(primary), column_b, column_c -------------------------------- abc | xyz | 123 def | xxx | 456
so after read table use this:
map.get("abc").get("column_b").equals("xyz") map.get("def").get("column_c").equals("456")
hope helps. note: chose first map have key of string because table may not have integers ids. can change them if think integer fit better.
Comments
Post a Comment