if (user != users[i]) { DatabaseCorrelator dc = new DatabaseCorrelator(user, users[i]); dc.process(); float correlation = dc.getCorrelation(); if (correlation > 0) {  treeMap.put(dc, dc);  }
try { if (!users[i].refersTo(user)) { ServerDatabase sd = users[i].getServerDatabase(); DatabaseCorrelator dc = new DatabaseCorrelator(user, sd); dc.process(); float correlation = dc.getCorrelation(); if (correlation > 0) {  treeMap.put(dc, dc);  } users[i].discard(); } } catch (IOException e) { e.printStackTrace();
  public ServerDatabase getBest(ServerDatabase user) {    ServerDatabase[] users = userList.getUsers();    TrackAverageRating tar = new TrackAverageRating();    TreeMap treeMap = new TreeMap(new Comparator() {      public int compare(Object o0, Object o1) {        DatabaseCorrelator dc0 = (DatabaseCorrelator) o0;        DatabaseCorrelator dc1 = (DatabaseCorrelator) o1;        if (dc0.getCorrelation() > dc1.getCorrelation())          return -1;        return 1;      }    });    for (int i = 0; i < users.length; i++) {      if (user != users[i]) {        DatabaseCorrelator dc = new DatabaseCorrelator(user, users[i]);        dc.process();        float correlation = dc.getCorrelation();        if (correlation > 0) {//          System.out.println("Friend: " + users[i].getUserName() + " " + dc.getCorrelation() + " " + dc.getSpares().getNoOfTracks());          treeMap.put(dc, dc);//          tar.add(dc.getSpares(), correlation);        }      }    }    int count = treeMap.size() / 10;    for (Iterator itr = treeMap.values().iterator(); count >= 0 && itr.hasNext(); count--) {      DatabaseCorrelator dc = (DatabaseCorrelator) itr.next();      tar.add(dc.getSpares(), dc.getCorrelation());//      if (dc.getSpares().getNoOfTracks() != 0)//        System.out.println("Friend: " + dc.getCorrelation() + " " + dc.getSpares().getNoOfTracks());    }    return tar.getAverages();  }