Use of double negation (!!) [duplicate]

It converts non-boolean types to boolean (dualvar(0,””) or 1). It is a shortcut way of doing this, instead of trying to cast it explicitly (which may take more characters). The ! operator negates the truthness of its argument. Hence, two of them are used. Many object types are “truthy”, and others are “falsey”. The only … Read more

Best way to define true, false, unset state

Boolean a = true; Boolean b = false; Boolean c = null; I would use that. It’s the most straight-forward. Another way is to use an enumeration. Maybe that’s even better and faster, since no boxing is required: public enum ThreeState { TRUE, FALSE, TRALSE }; There is the advantage of the first that users … Read more