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

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分给解决问题的人
...全文
114 点赞 收藏 14
写回复
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的标志字段用于记录位置,个数等
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告