7.1.9 How to remove page group or page list element within a single loop
I got "java.lang.UnsupportedOperationException: use ClipboardPage.remove(Object) " run-time exception, if I was trying to remove element of a page group property, (i.e. Work-.pyWorkParty) within a single loop using Engine API.
Is this a known issue or am I missing something here? Below is my java step.
pyWorkPartyIterator.remove(); // this step throws run-time exception
Below is the Engine API Java doc.
Returns an iterator allowing access to values contained in this list, page, or group property. Note that this iterator reflects the contents of this property at the time of its creation. Further changes to this property will not be reflected in this iterator.
the iterator. For most properties, the objects returned by Iterator.next() are ClipboardProperty instances. Lightweight page lists are the exception; in this case the objects are String arrays (String).
In some languages, you can't remove an element while looping over them, since the looping relies on the elements staying linked together. I don't know whether this language is one of those or not, but to be safe, how about moving all the elements you want to keep onto a new list, something like this:
Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next(). The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
I've never experienced that with a page group using the above method; the only time I've seen it is using a child step in a page list iteration using .PageList(Param.pyForEachCount) as the step page which is somewhat expected.
The above is how I've managed to steer clear of that issue.