public static Vector<Map<Integer,Double>> readDB(File file) throws IOException {
    BufferedReader in = new BufferedReader(new FileReader(file));
    Map<Integer,Integer> uid2raw = new HashMap<Integer,Integer>();
    Vector<Map<Integer,Double>> rawData = new Vector<Map<Integer,Double>>();
    int prevUid = -1;
    int maxUid = Integer.MIN_VALUE;
    String line = in.readLine();
    while (line != null) {
      String[] s = line.split("\\s+");
      
      int uid = Integer.parseInt(s[0]) - 1;
      int iid = Integer.parseInt(s[1]) - 1;
      double rate = Double.parseDouble(s[2]);
      
      if (prevUid != uid) {
        rawData.add(new TreeMap<Integer,Double>());
        uid2raw.put(uid, rawData.size() - 1);
        if (uid > maxUid) {
          maxUid = uid;
        }
      }
      rawData.get(rawData.size() - 1).put(iid, rate);
      
      prevUid = uid;;
      line = in.readLine();
    }
    in.close();
    
    // create final raw data
    Vector<Map<Integer,Double>> db = new Vector<Map<Integer,Double>>(maxUid + 1);
    for (int i = 0; i <= maxUid; i ++) {
      Integer rId = uid2raw.get(i);
      if (rId != null) {
        db.add(rawData.get(rId));
      } else {
        db.add(new TreeMap<Integer,Double>());
      }
    }
    
    return db;
  }