class SessionVote {

    @GET
    @Path("/averageRatingBySession")
    @Produces(APPLICATION_JSON)
    @Consumes(APPLICATION_JSON)
    public double sessionRatingAverage(@QueryParam("sessionId") String sessionId) {
        Collection<SessionRating> allSessionVotes = allSessionVotes(sessionId);
        int denominator = allSessionVotes.size();
        int numerator = 0;
        for (SessionRating rating : allSessionVotes) {
            numerator += rating.getRating();
        }
        return ((double) numerator / denominator);
    }

}