Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes Inverse Boolean Value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inverse Boolean Value" Watch "Inverse Boolean Value" New topic

Inverse Boolean Value

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
How do I re-write this to not equals?

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Putting aside the question of whether or not this is good code, you can just add a "!" (not):

new Boolean(!($F{day6r}.toString()+"/"+$F{day6o}.toString()).equals("0.0/0.0"))

[Jess in Action][AskingGoodQuestions]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
This works great. This is valid code for JasperReports PrintWhen expression.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11881

there is a difference between "good" code and "valid" code.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Inverse Boolean Value
It's not a secret anymore!