How to compare Boolean?

后端 未结 7 1492
太阳男子
太阳男子 2021-01-01 09:39

Take this for example (excerpt from Java regex checker not working):

while(!checker) {
    matcher = pattern.matcher(number);
    if(matcher.find())
                 


        
7条回答
  •  庸人自扰
    2021-01-01 09:56

    Using direct conditions (like ==, !=, !condition) will have a slight performance improvement over the .equals(condition) as in one case you are calling the method from an object whereas direct comparisons are performed directly.

提交回复
热议问题