Here is how you can remove items from a list that match a text pattern.
myList = ["lice",
"mice",
"dice",
"ice",
"mosquito",
"rice",
"apple",
"thrice"]
myList.removeAll {it -> it.contains("ice")}
assert myList == ["mosquito", "apple"]
Top comments (0)