私は Java 8 ストリームを試してきましたが、これが最小スコアと最大スコアを削除する最良の方法です。
private final Set<MatchScore> scores = new HashSet<>(10);
. . .
public double OPR() {
return scores.stream()
.mapToDouble(MatchScore::getScore)
.filter((num) -> { //Exclude min and max score
return num != scores.stream()
.mapToDouble(MatchScore::getScore)
.max().getAsDouble()
&&
num != scores.stream()
.mapToDouble(MatchScore::getScore)
.min().getAsDouble();
})
.average().getAsDouble();
}