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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -