Code: Select all
if (index < length(list)) removeElement(list,index);
addElement(list,index,object);
The alternative is to populate the list with the number of items it will be expected to contain at its maximum. That way, there will always be a replaceable element, and the code shrinks to
Code: Select all
removeElement(list,index);
addElement(list,index,object);
I'd like to be able to simply putElement(list,index,object) without bothering about insertion or insert position. To demonstrate the need, I am prepared to send you a flow, or a screenshot of one of its scripts . The script action "System" should be most illustrative:
http://automagic4android.com/flow.php?i ... 3ca59cc11e