Guava Tables
Posted by Kelvin on 13 Sep 2013 at 02:21 am | Tagged as: programming
Just discovered Guava's Table data structure. Whoa..!
https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained
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