Maintain ArrayList/LinkedList in UiPath Studio

Hey Community,

I hope this message finds you well. I have a requirement where I have to create an ArrayList/LinkedList (This is not compulsory if any other list resolves the problem). I want to create a list of 10 elements.

I have to insert the collected/extracted values into the list one by one. Once 10 values have been added to the list then on the 11th value the index 0 value must be removed and all 9 values must be pushed back and the 11th value be inserted on index 10.

This cycle keeps on repeating at each newly extracted value after the 10th extracted value. Removing the index 0 value pushed back the elements and the value at index 10.

Any help will highly be appreciated.

Best Regards,
Muhammad Anas.

init the list
myStringList = new List(Of String)

Assign activity
myStringList =
If(myList.Count >=10, myList.Skip(1).Append("NewValue").toList,myList.Append("NewValue").toList )

1 Like

Hey @ppr ,

Thanks for replying. I just wanted to confirm that this provided solution will push back the elements as well.

myList is myStringList or is it something else?

I am not sure if there is an automatic way of these elements being pushed/reassigned after 10th addition but you can use a Dictionary variable with Key as Int32 and Value as String.

Have a counter for keeping track of which element is being saved and if this counter crosses 9 then move all the elements using a for loop which loops over the Keys inside this dictionary.

I feel there maybe a better way of doing this as well and someone will for sure tell you soon but for now, you can try this logic. :slight_smile:

1 Like

Yes, we corrected above this inconsistency within the symbolic file names

for demo, we used a string list, which would also work for other Datatypes. You did not mention a specific one


done with:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.