当前位置:网站首页>Clear function of ArrayList
Clear function of ArrayList
2022-06-11 05:42:00 【wy36228】
There is a problem with the following code ,list_RowData.clear() After calling ,list_Data The stored data in is also cleared .
List<ArrayList> list_Data = new ArrayList<ArrayList>();
ArrayList list_RowData = new ArrayList<>();
if(cursor_selectedTable.moveToFirst())
{
do{
for (int i = 2; i<cursor_selectedTable.getColumnCount();i++)
{
list_RowData.add(cursor_selectedTable.getString(i));
}
list_Data.add(list_RowData);
list_RowData.clear();
}while (cursor_selectedTable.moveToNext());
}
This explanation list_Data.add(list_RowData); Just quoted list_RowData The address of , Change it to :
list_Data.add(new ArrayList(list_RowData));
Can solve the problem .
边栏推荐
- Get the full link address of the current project request URL
- NFC Development -- the method of using NFC mobile phones as access control cards (II)
- Multithreading tutorial (XXVIII) unsafe class
- NDK learning notes (VIII) thread related
- 如何让灯具智能化,单火、零火智能开关怎么选!
- 推荐一款免费的内网穿透开源软件,可以在测试本地开发微信公众号使用
- Multi threading tutorial (XXIV) cas+volatile
- Slide the receleview horizontally to the far right to listen to the page loading function
- 27、移除元素
- [go deep into kotlin] - get to know flow for the first time
猜你喜欢

Wechat applet, automatic line feed for purchasing commodity attributes, fixed number of divs, automatic line feed for excess parts

Stone game -- leetcode practice

Recherche sur l'optimisation de Spark SQL basée sur CBO pour kangourou Cloud Stack

Multithreading tutorial (XXVII) CPU cache and pseudo sharing

安装Oracle数据库

Install Oracle Database

es-ik 安装报错

(十五)红外通信

Wechat custom component - style - slot

Jsonobject jsonarray for parsing
随机推荐
Minimize maximum
Manually splicing dynamic JSON strings
[go deep into kotlin] - get to know flow for the first time
BERT知识蒸馏
PageHelper page 2 collections in the same interface
NDK learning notes (XI) POSIX sockect local communication
使用Batch读取注册表
Slide the receleview horizontally to the far right to listen to the page loading function
Bit operation marks multiple switches with one parameter
When the recyclerview plays more videos, the problem of refreshing the current video is solved.
Opencv learning path (2-4) -- Deep parsing cvtcolor function
WinForm (I) introduction to WinForm and use of basic controls
Multithreading tutorial (XXV) atomic array
Activity start process record
Multithreading tutorial (XXII) happens before principle
【深入kotlin】 - Flow 进阶
Configure the rust compilation environment
String sorting times --- bubble sorting deformation
深度学习分布式训练
1. use alicloud object OSS (basic)