Groovy web console

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

delegate

Published 2 months ago by p
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class ConfElemDesc {
  @Delegate Map<String, String> recordz = [:]
}

Map<ConfElemDesc, Integer> mm = [:]
mm.put(new ConfElemDesc([one:"bla"]), 10)
mm.put(new ConfElemDesc([two:"different"]), 20)
mm.put(new ConfElemDesc([three:"mra"]), 30)

List<ConfElemDesc> toSkip = [[one:"bla"] as ConfElemDesc, [two:"bra"] as ConfElemDesc, [three:"mra"] as ConfElemDesc]

println("before: " + mm)

toSkip.each { skipElem ->
  mm.remove(skipElem)
}

println("after: " + mm)