简体   繁体   English

如何更新数组列表中的值 <arraylist<Integer> &gt;

[英]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: 如果您具有2D ArrayList,请改用此命令:

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

Or this if you have a regular ArrayList: 如果您有常规的ArrayList,也可以这样:

arrayList.set(index, newValue);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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