当前位置:网站首页>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 .
边栏推荐
- Reading the registry using batch
- 20多种云协作功能,3分钟聊透企业的数据安全经
- Tencent X5 kernel initialization failed tbsreaderview not support by:***
- ELK日志系统实战(五):安装vector并将数据输出到es、clickhouse案例
- 使用Batch管理VHD
- Deep learning distributed training
- 创建酷炫的 CollectionViewCell 转换动画
- NDK learning notes (IV) functions, classes and exceptions of swig
- NDK learning notes (I)
- PageHelper page 2 collections in the same interface
猜你喜欢
随机推荐
Stone game -- leetcode practice
If the MAC fails to connect with MySQL, it will start and report an error
Games101 job 7-path tracing implementation process & detailed interpretation of code
Adapter the problem of executing only one animation in multiple frames
ReferenceError: server is not defined
在未来,机器人或 AI 还有多久才能具备人类的创造力?
Elk log system practice (V): install vector and output data to es and Clickhouse cases
Swap numbers (no temporary variables)
Combing route - Compaction Technology
C (I) C basic grammar all in one
[go deep into kotlin] - flow advanced
JS promise, async, await simple notes
YOLOv5的Tricks | 【Trick8】图片采样策略——按数据集各类别权重采样
[project - what are the supporting materials in the annexes? (18 kinds of 2000 word summary)] project plan of innovation and entrepreneurship competition and supporting materials of Challenge Cup entr
创建酷炫的 CollectionViewCell 转换动画
(十五)红外通信
[元数据]LinkedIn-DataHub
27. Remove elements
When the recyclerview plays more videos, the problem of refreshing the current video is solved.
Informatica: six steps of data quality management









