#replacing an item in an arraylist
1 messages · Page 1 of 1 (latest)
what exactly is it that you want to do?
if you want to replace a single element to a single other element, just access the items and change directly: (arrlist.items[index] = new_item;)
if you want to replace a single element with a sequence of other elements, use repalceRange with the len argument set to 1 (try arrlist.replaceRange(index, 1, new_items);)
ok thanks I wanted to replace one item with another
works accessing directly also for an arraylist of arraylists?
sure, just be careful to not leak any memory in the process: call .deinit() on the item you're about to override