高手请进,请教关于如何判断定长数组中的值问题。

feijipaopao 2004-10-08 04:57:06
比如说我有一个数组
String[] attrNames = { "Ind_Caller_Number_1","Ind_RBT_1","Ind_Group_ID_1",
"Ind_Caller_Number_2","Ind_RBT_2","Ind_Group_ID_2",
"Ind_Caller_Number_3","Ind_RBT_3","Ind_Group_ID_3",
"Ind_Caller_Number_4","Ind_RBT_4","Ind_Group_ID_4",
"Ind_Caller_Number_5","Ind_RBT_5","Ind_Group_ID_5",
"Ind_Caller_Number_6","Ind_RBT_6","Ind_Group_ID_6",
"Ind_Caller_Number_7","Ind_RBT_7","Ind_Group_ID_7",
"Ind_Caller_Number_8","Ind_RBT_8","Ind_Group_ID_8",
"Ind_Caller_Number_9","Ind_RBT_9","Ind_Group_ID_9",
"Ind_Caller_Number_10","Ind_RBT_10","Ind_Group_ID_10",
"Ind_Caller_Number_11","Ind_RBT_11","Ind_Group_ID_11",
"Ind_Caller_Number_12","Ind_RBT_12","Ind_Group_ID_12",
"Ind_Caller_Number_13","Ind_RBT_13","Ind_Group_ID_13",
"Ind_Caller_Number_14","Ind_RBT_14","Ind_Group_ID_14",
"Ind_Caller_Number_15","Ind_RBT_15","Ind_Group_ID_15",
"Ind_Caller_Number_16","Ind_RBT_16","Ind_Group_ID_16",
"Ind_Caller_Number_17","Ind_RBT_17","Ind_Group_ID_17",
"Ind_Caller_Number_18","Ind_RBT_18","Ind_Group_ID_18",
"Ind_Caller_Number_19","Ind_RBT_19","Ind_Group_ID_19",
"Ind_Caller_Number_20","Ind_RBT_20","Ind_Group_ID_20",
"Ind_Caller_Number_21","Ind_RBT_21","Ind_Group_ID_21",
"Ind_Caller_Number_22","Ind_RBT_22","Ind_Group_ID_22",
"Ind_Caller_Number_23","Ind_RBT_23","Ind_Group_ID_23",
"Ind_Caller_Number_24","Ind_RBT_24","Ind_Group_ID_24",
"Ind_Caller_Number_25","Ind_RBT_25","Ind_Group_ID_25" };
数组中有这么多的字段。我想知道怎么做能让我第一次或许更新前10个,第二次更新后10个,以及如何判断更新到那个子段了,并且知道更新了多少个字段。必须是这个数组。因为这是一个接口,我什么都改不了的。大家帮帮我啊。50分给解决问题的人
...全文
136 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
边城狂人 2004-11-05
  • 打赏
  • 举报
回复
设置一个一样大小的标志数组,boolean 型的,然后在这个标志数组里做标记
feijipaopao 2004-11-04
  • 打赏
  • 举报
回复
谁还有办法?
feijipaopao 2004-10-22
  • 打赏
  • 举报
回复
是啊。现在每次更新数组都要计算更新了那些。可是我没有好的思路。大家给出出主意。
LDH202 2004-10-22
  • 打赏
  • 举报
回复
限制的这么严格。。。。。

那只好生成另一个一模一样的数组,然后调用循环来判断了。

当然也可以记录其地址,因为基本上每个字符串都有不同的地址
feijipaopao 2004-10-22
  • 打赏
  • 举报
回复
我该如何知道这些数组那些是被更新了。那些是没有被更新的呢?
feijipaopao 2004-10-12
  • 打赏
  • 举报
回复
有没有使用过的代码给我看看,让我能够明白一些呢
边城狂人 2004-10-08
  • 打赏
  • 举报
回复
不需要定义成 static 的,关键是看在什么地方定义。
一般情况做,定义为一个类的成员可能会比定义为 static 的要好。
编程的时候要尽量少定义 static 的变量。
feijipaopao 2004-10-08
  • 打赏
  • 举报
回复
哦,明白了。
lulesheng1983 2004-10-08
  • 打赏
  • 举报
回复
static int index=0;
下次负值就可以记住起始位置了
lulesheng1983 2004-10-08
  • 打赏
  • 举报
回复
应该吧index定已成static
feijipaopao 2004-10-08
  • 打赏
  • 举报
回复
设置一个变量,保存当前更新到的 index
比如
String[] test = new String[50];
int index = 0;

for (int i = index; i < 10; ++i, ++index) {
test[i] = "a";
}

for (int i = index; i < 10; ++i, ++index) {
test[i] = "b";
}

能这么用吗?能不能给再细一些,该怎么用呢
alaal 2004-10-08
  • 打赏
  • 举报
回复
或者定义一个和array内容一样的list,

通过比较每一个位置的元素,知道哪个没有被更新
边城狂人 2004-10-08
  • 打赏
  • 举报
回复
设置一个变量,保存当前更新到的 index
比如
String[] test = new String[50];
int index = 0;

for (int i = index; i < 10; ++i, ++index) {
test[i] = "a";
}

for (int i = index; i < 10; ++i, ++index) {
test[i] = "b";
}
alaal 2004-10-08
  • 打赏
  • 举报
回复
定义几个static的标志字段用于记录位置,个数等

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧