//Teamstrength (version that works with higher probability)(without extra coms) public class Teamstrength implements ELO { //Map ratings = new HashMap(); @Override public List predictResult(List> teams) { return teams.stream().map(t -> (t.stream().mapToDouble(x -> (Math.pow(10,ratings.get(x)/400))).sum().getAsDouble() / teams.stream().flatMap(x -> x.stream()).mapToDouble(x -> (Math.pow(10,ratings.get(x)/400))).sum().getAsDouble() )).collect(Collectors.toList()); } //------------ //another implementation of predictResult to return single doubles and allow two team collections as input (no difference is made between them) only because I'm not sure how to combine them: //@Override public double predictResult(Collection> winnerTeams, Collection> loserTeams, Collection team) { return (team.stream().mapToDouble(x -> (Math.pow(10,ratings.get(x)/400))).sum().getAsDouble() / (winnerTeams.stream().flatMap(x -> x.stream()).mapToDouble(x -> (Math.pow(10,ratings.get(x)/400))).sum().getAsDouble()+loserTeams.stream().flatMap(x -> x.stream()).mapToDouble(x -> (Math.pow(10,ratings.get(x)/400))).sum().getAsDouble())); //------------ @Override public void evaluateResult(Collection> winnerTeams, Collection> loserTeams) { //As I'm not sure how to combine winnerTeams and loserTeams I use the above implementation of predictResult instead: winnerTeams.stream().forEach(t -> t.stream().forEach(x -> ratings.put(x, ratings.get(x) + 32*(1-predictResult(winnerTeams, loserTeams, t))/t.size()) ); loserTeams.stream().forEach(t -> t.stream().forEach(x -> ratings.put(x, ratings.get(x) + 32*predictResult(winnerTeams, loserTeams, t)/t.size()) ); } }