How to compare Boolean?

后端 未结 7 1449
太阳男子
太阳男子 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 10:11

    Try this:

    if (Boolean.TRUE.equals(yourValue)) { ... }
    

    As additional benefit this is null-safe.

提交回复
热议问题