java – Using groovy to match end of string

java – Using groovy to match end of string

An equivalent, but far more concise solution than this one is

import hudson.model.*

def list = Hudson.instance
                 .items
                 .findAll { it.buildable && it.name.endsWith(_TEST) }
                 .collect { it.name }

I actually found a different way around my problem. Sorry, Monday mornings 🙂

import hudson.model.*

def list = []

for (item in Hudson.instance.items.findAll()) {
  if (item.name.endsWith(_TEST)) {
    if (item.isBuildable()) {
      list.push(item.name)
    }
  }
}

return list

java – Using groovy to match end of string

Leave a Reply

Your email address will not be published. Required fields are marked *