Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
AtomicInteger and the other number atomics extend Number and so they support conversion to boolean through extension method asBoolean(Number). However, AtomicBoolean requires a separate extension method for this.
// you can omit ".asBoolean()" assert new AtomicBoolean(true).asBoolean() assert !new AtomicBoolean(false).asBoolean() assert !new AtomicBoolean(true).tap{set(false)}