Logo

dev-resources.site

for different kinds of informations.

Remove items matching a pattern from a list in Groovy

Published at
4/18/2023
Categories
groovy
Author
ou_ryperd
Categories
1 categories in total
groovy
open
Author
9 person written this
ou_ryperd
open
Remove items matching a pattern from a list in Groovy

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"]
Enter fullscreen mode Exit fullscreen mode
groovy Article's
30 articles in total
Favicon
Exploring Groovy: Features and Advantages Over Java
Favicon
Tasting Groogle
Favicon
Machine Learning with Spark and Groovy
Favicon
Groogle 4.0.0 (Google DSL)
Favicon
Tutorial: Learn how to use the H2 Database with Spring Boot! 🤔
Favicon
Mocking with Groovy
Favicon
Check for newer versions of dependencies in pom.xml
Favicon
Setting up linters in Gitlab CI for C++ and Groovy / Jenkins code
Favicon
Machine Learning con Groovy
Favicon
Groovy 🎷 Cheat Sheet - 01 Say "Hello" from Groovy
Favicon
Advice needed
Favicon
HackTheBox - Writeup Builder [Retired]
Favicon
The golden age of Kotlin and its uncertain future
Favicon
Probando a firmar documentos con Docuten
Favicon
Groogle al rescate
Favicon
Tech Watch #3 — October, 20, 2023
Favicon
Swagger-Operator, let groovy operate your cluster
Favicon
Nextflow: Organizando fotos por geoposicion
Favicon
🎶 Groovy: The Dynamic and Versatile JVM Language! 🚀
Favicon
FediSearch
Favicon
Introduction To Jenkins Shared Libraries
Favicon
Remove items matching a pattern from a list in Groovy
Favicon
Processing in parallel with Groovy
Favicon
Wednesday Links - Edition 2023-05-03 🇵🇱📜
Favicon
Wednesday Links - Edition 2023-04-26
Favicon
An Introduction to Jenkins Pipeline: Simplifying Continuous Integration and Delivery with Examples
Favicon
Graalvanizando un script de Groovy
Favicon
Passage of time calculations in Groovy
Favicon
Write a method like Python's string.printable in Groovy
Favicon
Neat time and date manipulation with Groovy

Featured ones: