Groovy web console

subscribe to the feed Subscribe
to this
site
Simpler Collection Handling (via #groovywebconsole)
tweet this snippet Tweet
this
script

Simpler Collection Handling

Published 6 months ago by ESK
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
// First gather up all of the parent/expected UUIDs (we'll hard-code for this example)
def expectedUUIDs = ['54c0590a-8277-4adf-905b-0a75e80eeacd', '9d6bc2a6-270b-475b-a7c3-d0d502a31322', '7f1df271-4daf-4c5b-84b2-eb7c13ce19a9']
// Next gather up all the UUIDs from subtasks (we'll hard-code for this example)
def subtaskUUIDs = ['9d6bc2a6-270b-475b-a7c3-d0d502a31322', '7f1df271-4daf-4c5b-84b2-eb7c13ce19a9']

// Which UUIDs are we still awaiting?
def missingUUIDs = expectedUUIDs - subtaskUUIDs
def done = (missingUUIDs.size() == 0)
println "Done = ${done}; Awaiting UUID(s): ${missingUUIDs}"

// Add in the missing one...
subtaskUUIDs << '54c0590a-8277-4adf-905b-0a75e80eeacd'

// Which UUIDs are we still awaiting?
missingUUIDs = expectedUUIDs - subtaskUUIDs
done = (missingUUIDs.size() == 0)
println "Done = ${done}; Awaiting UUID(s): ${missingUUIDs}"