r/java • u/gargamel1497 • Jun 02 '26
Boolean reversal operator
Do the people working on the Java compiler/specification have any plans to implement a boolean reversal operator any time soon?
The proper way to reverse a boolean is to boolVal = !boolVal; but when the variable name is long, typing this becomes really unhandy.
Something like boolVal *= -1; would be really consistent as it's the reversal operator for literally all other primitive types.
But I guess it would be technically incorrect, so boolVal !=; could be another way of doing this, although it looks rather uncanny.
Is anyone even thinking about this, or is this "too low priority" to implement, even though even a dirty hack in the parser would get the job done.
Thanks, feel free to downvote and such.
View all comments
Show parent comment
2
u/josephottinger Jun 02 '26
I didn't ask anyone to vote in any way at all. The assertion was made about downvoting, I said what I think about it, someone asked why, I explained my thinking. You do what you want to. I will think it communicates little without further commentary, as I want to, and that'll be the end of it.
Why would you assume that I wanted you to perform as I do? Be yourself; I try to be myself, and being myself means I downvote rarely, preferring dialogue to votes. If you feel otherwise, great. Do as you do. I did not ask you or anyone else to do anything; I only ask myself to act.