package design.model.statistics; import java.util.Arrays; import design.model.Hole; import design.model.Round; public class HoleStats extends StatisticsDecorator{ private Hole target_hole; public HoleStats(Statistics wrapped_statistics, Hole target_hole){ super(wrapped_statistics); this.target_hole = target_hole; } @Override public Round[] getRounds(){ return Arrays.stream(super.getRounds()) .filter(round -> round.getCourse().getHoles().stream().anyMatch(hole -> hole.equals(target_hole))) .toArray(Round[]::new); } }