Introduce new Run#getBuildsOverThreshold() method for getting runs above the desired execution result
* IntelliJ/Java: Duplicate code
Refactored as Run.getBuildsOverThreshold
* CheckForNull
* getBuildsOverThreshold: get RunT using _this()
@@ -994,19 +994,8 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* if not enough builds satisfying the threshold have been found. Never null.
*/
public List<RunT> getLastBuildsOverThreshold(int numberOfBuilds, Result threshold) {
-
- List<RunT> result = new ArrayList<>(numberOfBuilds);
-
RunT r = getLastBuild();
- while (r != null && result.size() < numberOfBuilds) {
- if (!r.isBuilding() &&
- (r.getResult() != null && r.getResult().isBetterOrEqualTo(threshold))) {
- result.add(r);
- }
- r = r.getPreviousBuild();
- }
-
- return result;
+ return r.getBuildsOverThreshold(numberOfBuilds, threshold);
}
/**
