I have SQL request that returns (x,y,z) tuples with :
- x between 1 and 9
- y between 1 and 500
- z between 1 and 15
So I have 9 * 500 * 15 = 67500 possibilities maximum and 0 possibilities minimum if all my 67500 possibilities are stored into database.
I can have (4, 256, 1) for example in my lists but not (3, 410, 8).
I want to generate 3 linked lists. For example if I choose x=2 I want the second list to display all the available y for this x value and idem for z values with y choice.
Should I use Collection ar Array to retrieve easily values to generate mys lists ?
With the keys falling in small ranges like this, a simple 2D array of
shorts would be sufficient:The first index is the value of
x; the second index is the value ofy.The values of
zare stored as individual bits of theshortat[x][y]. To access individual bits, use bit operations:This data structure is very efficient in space: it needs roughly 10KBytes of memory to store the entire data set.