Hi I'm looking for a way to implement a table in memory to store data of primitive types (strings, integers, floats, etc), and would like to have a way to query data. I think using HashMap provides a good store (unless someone has a better idea), and there are 2 ways of doing this.
Assuming we have a row like this for the following example implementation.
Name, Sex, Rank, Dept, Age
Jane, Female, Manager, HR, 37
In this case, we are using only one map object. We are going to store the primary key column as a key of the map, and the rest of the columns in a delimited fashion as value of the map.
In this case, we are using a list of maps. We are going to store the columns of each row in a map, and then store this map in a list.
1) Which way of implementing this is better? And are there even better ways of doing this? There may be pros and cons with each approach and I'm happy to see what comments we have.
2) If I want to perform SQL like queries over this data? Is there a Java library that I can add and provides SQL syntax support? For example, the following should be possible but I haven't found such a library.