I have an arraylist in which i want to set another array list at positions [0] and [1] every time.For example my arraylist has index [5] and [6].I want to set another array list at the above positions at index positions [0] and [1] on both.How can I do that?
1 Answer
You could use the set() method of ArrayList.
public E set(int index, E element)Replaces the element at the specified position in this list with the specified element.
set(index, element)function. For Example,list.set(0, object).