Package hudson.util
Class RunList<R extends Run>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<R>
-
- hudson.util.RunList<R>
-
- All Implemented Interfaces:
Iterable<R>
,Collection<R>
,List<R>
public class RunList<R extends Run> extends AbstractList<R>
- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RunList<R>
byTimestamp(long start, long end)
Filter the list by timestamp.RunList<R>
completedOnly()
Filter the list to completed builds.RunList<R>
failureOnly()
Filter the list to non-successful builds only.RunList<R>
filter(com.google.common.base.Predicate<R> predicate)
Deprecated.RunList<R>
filter(Predicate<R> predicate)
Returns elements that satisfy the given predicate.static <J extends Job<J,R>,R extends Run<J,R>>
RunList<R>fromJobs(Iterable<? extends J> jobs)
Creates a aRunList
combining all the runs of the supplied jobs.static <R extends Run>
RunList<R>fromRuns(Collection<? extends R> runs)
R
get(int index)
R
getFirstBuild()
Deprecated.seesize()
for why this violates lazy-loadingR
getLastBuild()
int
indexOf(Object o)
boolean
isEmpty()
Iterator<R>
iterator()
int
lastIndexOf(Object o)
RunList<R>
limit(int n)
Return only the most recent builds.RunList<R>
newBuilds()
Reduce the size of the list by only leaving relatively new ones.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.RunList<R>
overThresholdOnly(Result threshold)
Filter the list to builds above threshold.RunList<R>
regressionOnly()
Filter the list to regression builds only.int
size()
Spliterator<R>
spliterator()
List<R>
subList(int fromIndex, int toIndex)
AbstractList.subList(int, int)
isn't very efficient on ourIterable
based implementation.-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, listIterator, listIterator, remove, removeRange, set
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Constructor Detail
-
RunList
public RunList()
-
RunList
public RunList(Job j)
-
RunList
public RunList(View view)
-
RunList
public RunList(Collection<? extends Job> jobs)
-
-
Method Detail
-
fromJobs
public static <J extends Job<J,R>,R extends Run<J,R>> RunList<R> fromJobs(Iterable<? extends J> jobs)
Creates a aRunList
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
-
size
@Deprecated public int size()
-
get
@Deprecated public R get(int index)
-
subList
public List<R> subList(int fromIndex, int toIndex)
AbstractList.subList(int, int)
isn't very efficient on ourIterable
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.
-
spliterator
public Spliterator<R> spliterator()
-
indexOf
public int indexOf(Object o)
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<R extends Run>
- Overrides:
lastIndexOf
in classAbstractList<R extends Run>
-
isEmpty
public boolean isEmpty()
-
getFirstBuild
@Deprecated public R getFirstBuild()
Deprecated.seesize()
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<=;e
. Warning: this method mutates the original list and then returns it.
-
-