private double getAverageByID(String id, int minimalRaters) { int count = 0; double total = 0.0; for (Rater rater : myRaters) { if (rater.hasRating(id)) { total += rater.getRating(id); count++; } } if (count < minimalRaters) return 0.0; return total / count; }