java - Do for loop in two parts -


how write in 1 loop

for (file file:files)   {     if (file.getname().endswith(".dat"))   {        species x = reader.readspecies(file);        allspecies.add(x);        allgenes.addall(x.getgenome());     } }  (file file:files){      if (file.getname().endswith(".dat")) {        species x = reader.readspecies(file);        x.setindices(allgenes);      } } 

i want run through loop 1 segment next using 1 loop. possible? if not, code writing in violation of dry?

okay, no 1 answered far has understood question @ all. want code go through entire first loop. , entire second loop. set indices method not work until allgenes.addall has been completed ever file in loop.

it should

for (file file:files){         if (file.getname().endswith(".dat")){             species x = reader.readspecies(file);                             allspecies.add(x);             allgenes.addall(x.getgenome());             x.setindices(allgenes);         } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -