How to compare Boolean? September 5, 2023 by Tarik Try this: if (Boolean.TRUE.equals(yourValue)) { // ... } As additional benefit, this comparison is null-safe.