diff --git a/core/src/main/java/hudson/util/PersistedList.java b/core/src/main/java/hudson/util/PersistedList.java index 60c9013a22a3395343a4910928c5c2ec16b27a73..52d20a3caf96f30fa288954cd82235f01314120f 100644 --- a/core/src/main/java/hudson/util/PersistedList.java +++ b/core/src/main/java/hudson/util/PersistedList.java @@ -118,6 +118,21 @@ public class PersistedList implements Iterable { } } + /** + * A convenience method to replace a single item. + * + * This method shouldn't be used when you are replacing a lot of stuff + * as copy-on-write semantics make this rather slow. + */ + public void replace(T from, T to) throws IOException { + List copy = new ArrayList(data.getView()); + for (int i=0; i