NandaKumar NandaKumar - 3 months ago 11
Java Question

Using table guava for hashbasedTable

I am planning to use table guava for a 3D hash map implementation. I downloaded that and I am able to import the files. My requirement is the below

I have the below file in my hand and I just have to aggregate the file accordingly and that is shown in the next step.


The aggregation part would be below


I tried using the below

Table<String,String,Integer> twoDimensionalFileMap= new HashBasedTable<String,String,Integer>();

But this throws me an error, I just want to know two things

  1. I just want to know, the arguments to be passed in the constructor of the

  2. How to initialize the row,column and the value for this table just like we do it for the map it is
    . In the similar sense could you guys tell me how to insert the values for this table?


Guava contributor here.

  1. Don't use the constructor, use the HashBasedTable.create() factory method. (With no arguments, or with expectedRows and expectedCellsPerRow.)
  2. Use table.put("A100", "B100", 5), just like a Map except with two keys.