Java: How to remove objects from an Array depending on the condition?

Viewed 19693

I have an array of Objects (file list excatly). How to iterate through this array and delete some Objects (in Java) - depending on the condition ?

File[] files = file.listFiles();
for(File f: files) {
   if(someCondition) {
       // remove
   }
}
6 Answers
Related