I want to replace some Words in String without using any loops.
def tagList= []
def tags= []
tags.each { tag ->
def newString = tag.replaceAll("sample", "")
tagList.add(newString)
}
This is the goodness of groovy you can directly replace string without iterating the List.
please try below code
def tagList= []
tagList = tags.join(',').replaceAll('sample','').split(',')