Ejemplo n.º 1
0
 public Map<String, List<String>> readInvertedMapListFromTsvReader(
     BufferedReader reader, int logFrequency) throws IOException {
   Map<String, List<String>> map = Maps.newHashMap();
   String line;
   int line_number = 0;
   while ((line = reader.readLine()) != null) {
     line_number++;
     if (logFrequency != -1) {
       logEvery(logFrequency, line_number);
     }
     String[] fields = line.split("\t");
     String key = fields[0];
     for (int i = 1; i < fields.length; i++) {
       String value = fields[i];
       // Remember, this is an _inverted_ map, so switching the value and key is correct.
       MapUtil.addValueToKeyList(map, value, key);
     }
   }
   return map;
 }
Ejemplo n.º 2
0
 // These logEvery methods fit here, for now, because I only ever use them when I'm parsing
 // through a really long file and want to see progress updates as I go.
 public void logEvery(int logFrequency, int current) {
   logEvery(logFrequency, current, Integer.toString(current));
 }