0

I have an array list array list, I am trying to change the value in a specific element, but it tells me that the left hand side must be a variable. I am trying to update using this,

list.getMyList().get(4).get(5) = value;

Am I doing this incorrect, how would I update that element?

1
  • 1
    What is getMyList() here. Please clearly state the question. Commented Dec 6, 2015 at 2:17

1 Answer 1

3

Use this instead if you have a 2D ArrayList:

arrayLists.get(1).set(index, newValue);

Or this if you have a regular ArrayList:

arrayList.set(index, newValue);
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.