Adding an item to arrayList at a specific index
Hi, Im trying to add an element to a specific index in an ArrayList
I know for an arrayList if you want to add an element to a specific place you do write arraylist.add(1, 5) to add 5 to position 1, but do you know how to put a variable name in instead of a number.
I tried arrayList.add(count, 5) where count equals an integer but I keep getting an out of bounds exception
Count will constantly change and i need to add the elements to the index which equals it.
Any help would be greatly appreciated
Thank you very much :)