Why should I pass Boolean as a parameter instead of "boolean"?
jakarta-ee, java
Solution
Actually I tend to err on the side of passing small-b boolean instead, because I know that a primitive boolean is never going to be null. I'm sure there are valid reasons for using the Boolean type, but I'd want to think about its use in each case.
Problem
A co-worker asked me to change a signature from using a primitive "boolean" to using a classed "Boolean". He didn't offer a very good explanation why? Have any of you heard of this and can any of you explain why it matters or doesn't matter? Edit: He mentioned that it was good practice for public methods. The use of the field is just a flag that tells me whether to call one flow or another depending on whether it's true or false.