Skip to content

Instantly share code, notes, and snippets.

@Kun-Yao-Lin
Created January 22, 2018 02:11
Show Gist options
  • Save Kun-Yao-Lin/b2bc74c5fc1eec91457e9b35af6f99af to your computer and use it in GitHub Desktop.
Save Kun-Yao-Lin/b2bc74c5fc1eec91457e9b35af6f99af to your computer and use it in GitHub Desktop.
// savedlocation_x <- 原 List
List<Integer> copy2=new ArrayList<>(savedlocation_x); // 將 savedlocation_x copy 至新的 list
//改成下列寫法
int i = 0;
int breakIndex = 4;
for(Integer in : savedlocation_x){
if(i > breakIndex){
break;
}
i++;
copy2.remove(in);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment