0

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
  • You can use set(index, element) function. For Example, list.set(0, object). Commented Feb 27, 2016 at 15:27

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.