multiple keys and values with google-collections
- by flash3000
Hello,
I would like use google-collection in order to save the following file in a Hash with multiple keys and values
Key1_1, Key2_1, Key3_1, data1_1, 0, 0
Key1_2, Key2_2, Key3_2, data1_2, 0, 0
Key1_3, Key2_3, Key3_3, data1_3, 0, 0
Key1_4, Key2_4, Key3_4, data1_4, 0, 0
The first three columns are the different keys and the last two integer are the two different values. I have already prepare a code which spilt the lines in chunks.
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class HashMapKey {
public static void main(String[] args) throws FileNotFoundException, IOException {
String inputFile = "inputData.txt";
BufferedReader br = new BufferedReader(new FileReader(inputFile));
String strLine;
while ((strLine = br.readLine()) != null) {
String[] line = strLine.replaceAll(" ", "").trim().split(",");
for (int i = 0; i < line.length; i++) {
System.out.print("[" + line[i] + "]");
}
System.out.println();
}
}
}
Unfortunately, I do not know how to save these information in google-collection?
Thank you in advance.
Best regards,