Source From Here
Preface
We know Groovy has a lot of nice methods for working with collections. For example in previous blog posts we have seen how to take or drop elements from a list and even with a condition. Since Groovy 2.4 we can now also use the dropRight and takeRight methods to take or drop elements from the end of the list.
Example
In the following example we have a simple list and we use the dropRight and takeRight methods to get elements from the list:
Preface
We know Groovy has a lot of nice methods for working with collections. For example in previous blog posts we have seen how to take or drop elements from a list and even with a condition. Since Groovy 2.4 we can now also use the dropRight and takeRight methods to take or drop elements from the end of the list.
Example
In the following example we have a simple list and we use the dropRight and takeRight methods to get elements from the list:
沒有留言:
張貼留言