Fastest way to check if an array of boolean contains true

后端 未结 7 903
余生分开走
余生分开走 2021-01-12 04:08

I have an array of boolean entries:

boolean[] myBooleanArray = new boolean[24];

Currently i check if it contains

相关标签:
7条回答
  • 2021-01-12 04:45

    If you had an array of 0's and 1's, you could simply OR every element. If you get a 1, you know there is atleast one TRUE.

    0 讨论(0)
提交回复
热议问题