I've come across this code in one of the projects I'm working on

(This is in Java)

if (Boolean.TRUE.equals(foo.isBar()))

Foo#isBar() is defined as boolean isBar(), so it can't return null

Is there really any reason why it should be written that way? I myself would just write

if (foo.isBar())

, but perhaps I'm missing something subtle.

Thanks

Edit
Report