sinat_33415638 于 2016.01.19 13:41 提问

for(int c=0;c<date1.size();c++){
if(date1.get(c).equals(date1.get(c+1))){
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
}else{
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
sum=0;
}

``````    }
``````

7个回答

a8761087   2016.01.19 14:28

91program      2016.01.19 14:29

Theresa_zxx   2016.01.19 14:04

`````` for(int c=0;c<date1.size();c++){
if(c < date1.size()){
if(date1.get(c).equals(date1.get(c+1))){
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
}
}else{
if(c < date1.size()){
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
sum=0;
}
}
``````
wojiushiwo945you      2016.01.19 14:06

``````        for(int c=0;c+1<date1.size();c++){
if(date1.get(c).equals(date1.get(c+1))){
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
}else{
a=(int) value1.get(c);
sum=a+sum;
System.out.println("a:"+a+"sum："+sum);
sum=0;
}
}
``````
piaoxueergogo   2016.01.19 14:35

for(int c=0;c+1<date1.size();c++){
||
for(int c=0;c+1<date1.size()-1;c++){

enpterexpress   2016.01.19 14:35

qq_17194815   2016.01.19 19:52