Groovy web console

subscribe to the feed Subscribe
to this
site
json string empty (via #groovywebconsole)
tweet this snippet Tweet
this
script

json string empty

Published 2 months ago by dan
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def rpIDs = [1, 2, ""]

try {
    assert rpIDs.findAll{ !it }.collect{ it.toLong() } == [1,2]
}catch (Exception e) {
    println e
}

def rps = rpIDs.findAll{ it?.toString() != "" }.collect{ it?.toLong() }
assert rps == [1,2]
println rps