Groovy web console

subscribe to the feed Subscribe
to this
site

List Truthy Check

Published 5 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
List<String> subscriptions

println "List<String> subscriptions"
println "--------------------------"
println "${!subscriptions} - truthy check"
println "${subscriptions == null} - null check\n"

subscriptions = []

println "List<String> subscriptions = []"
println "--------------------------"
println "${!subscriptions} - truthy check"
println "${subscriptions == null} - null check\n"

subscriptions = ["test"]

println "List<String> subscriptions = [\"test\"]"
println "--------------------------"
println "${!subscriptions} - truthy check"
println "${subscriptions == null} - null check\n"