keyword "in" is used in Groovy to check whether element exists in Collection. Example ListString str = "this is me " List list = str.tokenize(" ") String word = "this" assert word in list == true assert "hello" in list == falseExample with Set
Set set = ["this","is","me"] String word = "this" assert word in set == true assert "hello" in set == false
This entry was posted
on November 29th, 2010
at
2:00 am and is filed under
Grails, Groovy .
You can follow any responses to this entry through the
RSS 2.0 feed.
You can leave a response, or trackback from your own site.
