Package hudson.util

Class RunList<R extends Run>

All Implemented Interfaces:
Iterable<R>, Collection<R>, List<R>

public class RunList<R extends Run> extends AbstractList<R>
List of Runs, sorted in the descending date order.
Author:
Kohsuke Kawaguchi
  • Constructor Details

    • RunList

      public RunList()
    • RunList

      public RunList(Job j)
    • RunList

      public RunList(View view)
    • RunList

      public RunList(Collection<? extends Job> jobs)
  • Method Details

    • fromJobs

      public static <J extends Job<J, R>, R extends Run<J, R>> RunList<R> fromJobs(Iterable<? extends J> jobs)
      Creates a a RunList combining all the runs of the supplied jobs.
      Type Parameters:
      J - the base class of job.
      R - the base class of run.
      Parameters:
      jobs - the supplied jobs.
      Returns:
      the run list.
      Since:
      2.37
    • iterator

      public Iterator<R> iterator()
      Specified by:
      iterator in interface Collection<R extends Run>
      Specified by:
      iterator in interface Iterable<R extends Run>
      Specified by:
      iterator in interface List<R extends Run>
      Overrides:
      iterator in class AbstractList<R extends Run>
    • size

      @Deprecated public int size()
      Deprecated.
      as of 1.485 RunList, despite its name, should be really used as Iterable, not as List.
      Specified by:
      size in interface Collection<R extends Run>
      Specified by:
      size in interface List<R extends Run>
      Specified by:
      size in class AbstractCollection<R extends Run>
    • get

      @Deprecated public R get(int index)
      Deprecated.
      as of 1.485 RunList, despite its name, should be really used as Iterable, not as List.
      Specified by:
      get in interface List<R extends Run>
      Specified by:
      get in class AbstractList<R extends Run>
    • subList

      public List<R> subList(int fromIndex, int toIndex)
      AbstractList.subList(int, int) isn't very efficient on our Iterable based implementation. In fact the range check alone would require us to iterate all the elements, so we'd be better off just copying into ArrayList.
      Specified by:
      subList in interface List<R extends Run>
      Overrides:
      subList in class AbstractList<R extends Run>
    • spliterator

      public Spliterator<R> spliterator()
    • indexOf

      public int indexOf(Object o)
      Specified by:
      indexOf in interface List<R extends Run>
      Overrides:
      indexOf in class AbstractList<R extends Run>
    • lastIndexOf

      public int lastIndexOf(Object o)
      Specified by:
      lastIndexOf in interface List<R extends Run>
      Overrides:
      lastIndexOf in class AbstractList<R extends Run>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<R extends Run>
      Specified by:
      isEmpty in interface List<R extends Run>
      Overrides:
      isEmpty in class AbstractCollection<R extends Run>
    • getFirstBuild

      @Deprecated public R getFirstBuild()
      Deprecated.
      see size() for why this violates lazy-loading
    • getLastBuild

      public R getLastBuild()
    • fromRuns

      public static <R extends Run> RunList<R> fromRuns(Collection<? extends R> runs)
    • filter

      public RunList<R> filter(Predicate<R> predicate)
      Returns elements that satisfy the given predicate. Warning: this method mutates the original list and then returns it.
      Since:
      2.279
    • filter

      @Deprecated public RunList<R> filter(com.google.common.base.Predicate<R> predicate)
      Deprecated.
      Returns elements that satisfy the given predicate. Warning: this method mutates the original list and then returns it.
      Since:
      1.544
    • limit

      public RunList<R> limit(int n)
      Return only the most recent builds. Warning: this method mutates the original list and then returns it.
      Parameters:
      n - a count
      Returns:
      the n most recent builds
      Since:
      1.507
    • failureOnly

      public RunList<R> failureOnly()
      Filter the list to non-successful builds only. Warning: this method mutates the original list and then returns it.
    • overThresholdOnly

      public RunList<R> overThresholdOnly(Result threshold)
      Filter the list to builds above threshold. Warning: this method mutates the original list and then returns it.
      Since:
      1.517
    • completedOnly

      public RunList<R> completedOnly()
      Filter the list to completed builds. Warning: this method mutates the original list and then returns it.
      Since:
      1.561
    • node

      public RunList<R> node(Node node)
      Filter the list to builds on a single node only Warning: this method mutates the original list and then returns it.
    • regressionOnly

      public RunList<R> regressionOnly()
      Filter the list to regression builds only. Warning: this method mutates the original list and then returns it.
    • byTimestamp

      public RunList<R> byTimestamp(long start, long end)
      Filter the list by timestamp. s&lt=;e. Warning: this method mutates the original list and then returns it.
    • newBuilds

      public RunList<R> newBuilds()
      Reduce the size of the list by only leaving relatively new ones. This also removes on-going builds, as RSS cannot be used to publish information if it changes. Warning: this method mutates the original list and then returns it.