| Return type | Name and parameters |
|---|---|
boolean
|
asBoolean()
Coerce an Optional instance to a boolean value. |
Optional
|
collect(Closure transform)
If the optional contains a value, returns an optional containing the transformed value obtained using the transform closure
or otherwise an empty optional.
|
addShutdownHook, any, any, asBoolean, asType, collect, collect, collect, contains, count, dump, each, eachWithIndex, equals, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, flatten, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, groupBy, groupBy, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, iterator, join, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, size, split, sprintf, sprintf, sum, sum, tap, toArrayString, toSpreadMap, toString, use, use, use, with, with, withTraits
Coerce an Optional instance to a boolean value.
true if a value is present, otherwise falseIf the optional contains a value, returns an optional containing the transformed value obtained using the transform closure
or otherwise an empty optional.
assert Optional.of("foobar").collect{ it.size() }.get() == 6
assert !Optional.empty().collect{ it.size() }.isPresent()
transform - the closure used to transform the optional value if present