当事件发生时,我想摆脱“for循环”。例如,我的代码有一部分:
for (ScanResult scanResult : listeScan) {
if(sampleposition[position]==0){
change=true;
while(i < position && change==true){
if(macAdress[i].equals(scanResult.BSSID)){
change = false;
}
i++;
}
i=0;
if(change == true && scanResult.level >= -80){
valueSSID[position] = scanResult.level;
macAdress[position] = scanResult.BSSID;
sSID[position] = scanResult.SSID;
if(valueSSID[position]!=0){sampleposition[position]++;}
//exit here
}
}
else{
if(macAdress[position].equals(scanResult.BSSID) && sampleposition[position]<=totalsample){addlevel=scanResult.level;} else {addlevel=0;}
valueSSID[position] = valueSSID[position] + addlevel;
if(addlevel!=0){sampleposition[position]++;}
//exit here
}
}
}
实际上,我想停止有“exit here”评论的循环。
拜托,你能告诉我我该怎么做吗?对不起我的英语不好...