Creates a new List composed of the elements of the original without those specified in the collection.
Syntax
List minus(Collection collection)
Parameters
Collection – The collection of values to minus from the list.
Return Value
New list of values.
Example
Following is an example of the usage of this method −
class Example { static void main(String[] args) { def lst = [11, 12, 13, 14]; def newlst = []; newlst = lst.minus([12,13]); println(newlst); } }
When we run the above program, we will get the following result −
[11, 14]
Previous Page:-Click Here
Pingback: Groovy - Lists - Adglob Infosystem Pvt Ltd