Java for loop vs. while loop. Performance difference?

前端 未结 16 1608
长发绾君心
长发绾君心 2020-11-28 09:35

Assume i have the following code, there are three for loop to do something. Would it run fast if i change the most outer for loop to while loop? thanks~~

<         


        
16条回答
  •  心在旅途
    2020-11-28 10:33

    Look at your algorithm! Do you know beforehand which values from your array are added more than one time?

    If you know that you could reduce the number of loops and that would result in better performance.

提交回复
热议问题