简体   繁体   中英

How to update a value in an arraylist<arraylist<Integer>>

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?

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM