简体   繁体   English

如何在条件条件下多次执行而不中断Java中的for循环?

[英]how execute if condition several times without break inside for loop in java?

In the following code I want to execute the if condition inside the outer for loop several times, but in the following code it only executes once and executes the steps after it. 在下面的代码中,我想多次在外部for循环内执行if条件,但是在下面的代码中,它仅执行一次,然后执行之后的步骤。 binaryHashResult is an array and innerNode is a List . binaryHashResult是一个arrayinnerNode是一个List I want to check if all values in array exist in list . 我想检查array中的所有values是否存在于list

for (int j = 0; j < binaryHashResult.length; j++) 
    if (innerNode[binaryHashResult[j]] == 1.0)
        for (int h = 0; h < m.children.size(); h++) {
            BloomFilterIndex.BFINode<Integer> s=m.children.get(h);
            searchencryptedNode(binaryHashResult, e,  k, s);
        }  

Always wrap blocks of code with {} regardless if the block has only one line. 始终用{}包装代码块,无论该块只有一行。

for (int j = 0; j < binaryHashResult.length; j++) 
    if (innerNode[binaryHashResult[j]] == 1.0) {
        for (int h = 0; h < m.children.size(); h++) {
            BloomFilterIndex.BFINode<Integer> s=m.children.get(h);
            searchencryptedNode(binaryHashResult, e,  k, s);
        } // closes inner for loop
   } // closes if
} // closes outer for loop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM