The question but in C#. Quindi Java ha il comando di C#? Mi serve per la relazione Matches-SearchTerm-Files.Java: iterando nell'elenco delle liste?
foreach(var i in BunchOfItems.SelectMany(k => k.Items)) {}
[perché non per-loop?] ho fatto tali strutture in cicli for innestati ma presto diventerà gonfio. Quindi preferisco qualcosa di più simile a quanto sopra.
public static Stack<Integer[]> getPrintPoss(String s,File f,Integer maxViewPerF)
{
Stack<File> possPrint = new Stack<File>();
Integer[] poss = new Integer[4]();
int u,size;
for(File f:files)
{
size = f2S(f).length();
u = Math.min(maxViewsPerF,size);
for(int i=0; i<u;i++)
{
// Do something --- bloated, and soon out of control
// wants more succintly
}
}
return possPrint;
}
Questa libreria ha un'implementazione selectMany() che dovrebbe assomigliare a questo per il vostro requisito: for (val i: BunchOfItems.selectMany (bunchItemSelector()) {}. Vedere https://github.com/nicholas22/jpropel-light –