Eric Milles created GROOVY-10655:
------------------------------------

             Summary: Add extension method for coercing AtomicBoolean to 
boolean value
                 Key: GROOVY-10655
                 URL: https://issues.apache.org/jira/browse/GROOVY-10655
             Project: Groovy
          Issue Type: Improvement
          Components: groovy-jdk
            Reporter: Eric Milles
            Assignee: Eric Milles


{{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.

{code:groovy}
 // you can omit ".asBoolean()"
 assert  new AtomicBoolean(true).asBoolean()
 assert !new AtomicBoolean(false).asBoolean()
 assert !new AtomicBoolean(true).tap{set(false)}
{code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to