var data = new Map<string, Map<string, Set<Item>>>();
where the strings are rowKeyN and columnKeyN and Set contains the items in each cell.
This kind of datastructure seems a bit complicated to use but is the best that I found in terms of performance. What do you think? Thank you in advance.
Bumped into this question - you should look at Guava's (for Java) Table representation - where the last case you would get a List
but in short: taken from the docs:
Table<Vertex, Vertex, Double> weightedGraph = HashBasedTable.create(); weightedGraph.put(v1, v2, 4); weightedGraph.put(v1, v3, 20); weightedGraph.put(v2, v3, 5); weightedGraph.row(v1); // returns a Map mapping v2 to 4, v3 to 20 weightedGraph.column(v3); // returns a Map mapping v1 to 20, v2 to 5
In your case it would be
I came here while trying to search something like the above for Typescript - I haven't found it - yet - if anyone knows of such an implementation - let me know