I understand it should be pretty simple but...
- I have primitive java boolean.
- I believe such a simple things should not require additional method coding.
- I strongly dislike ternary operator and inline conditions (
?
for those who want reputation and trying to answer anything even without reading question). So(value ? 1 : 0)
is not for me. - I cannot use nice fragment like
value.compareTo(false)
because it isprimitive
.
What I'd like to get is something like last point but for primitives. Surprised there is no good way to do such a plain useful conversion? Me to. Is your google bigger than my one? ;-D
UPDATE:
OK, finally I've decided to write my own method for this case as there is not only type conversion but some logic that could be extended in future and I'd like to have it encapsulated. Thanks to all people participated.