Skip to content
Permalink
Browse files
[FIXED JENKINS-34645] Serializable array iterator.
  • Loading branch information
jglick committed Aug 21, 2017
1 parent 459fe61 commit bc3c49ec9e375c599d9c6ca1a11b23df018ebb6f
@@ -29,6 +29,7 @@
import java.util.AbstractList;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -97,6 +98,11 @@
return new Itr<>(new ArrayList<>(set));
}

public static <E> Iterator<E> iterator(E[] array) {
// TODO as above
return new Itr<>(Arrays.asList(array));
}

private static final class ListItr<E> extends Itr<E> implements ListIterator<E> {
private static final long serialVersionUID = 1;
ListItr(List<E> list, int idx) {
@@ -79,6 +79,17 @@
});
}

@Issue("JENKINS-34645")
@Test public void stringSplit() {
rr.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
WorkflowJob p = rr.j.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("for (x in 'a;b'.split(';')) {sleep 1; echo(/running in $x/)}", true));
rr.j.assertLogContains("running in b", rr.j.buildAndAssertSuccess(p));
}
});
}

@Issue("JENKINS-27421")
@Test public void mapIterator() {
rr.addStep(new Statement() {

0 comments on commit bc3c49e

Please sign in to comment.