gpt4 book ai didi

java - 如何在数组列表中插入每 10 行?

转载 作者:行者123 更新时间:2023-12-01 12:48:14 26 4
gpt4 key购买 nike

如何将数组列表中的每 10 行插入到?这是我的代码:

 openDB();
Cursor c = myDb.getSpalte();
List<Integer> valueList = new ArrayList<Integer>(c.getCount());

while (c.moveToNext()) {
valueList.add(c.getInt(1));

}
c.close();
closeDB();

最佳答案

 openDB();
Cursor c = myDb.getSpalte();
List<Integer> valueList = new ArrayList<Integer>(c.getCount());

List<Integer> tenthRows = new ArrayList<Integer>();
counter = 0;
while (c.moveToNext()) {
Integer value = c.getInt(1);
valueList.add(value );
counter++;
if(counter == 10) {
tenthRows.add(value)
counter = 0;
}
}
c.close();
closeDB();

关于java - 如何在数组列表中插入每 10 行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24475194/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com