|
|
Re: [Acceleo] select over a Set(String) object [message #904517 is a reply to message #904500] |
Tue, 28 August 2012 15:25 |
|
My aim is not to iterate over the set. I need to do something only if a string (say 'test') is contained in the set. If the set does not contain that string I need to do something else.
i.e.
[if setOfString->select(??='test')->notEmpty()]
generate something
[else]
generate something else
[/if]
How would you do that by means of an iterator?
Follow me on Twitter @andreasindico
|
|
|
|
|
Re: [Acceleo] select over a Set(String) object [message #904802 is a reply to message #904558] |
Wed, 29 August 2012 07:24 |
|
Andrea,
Ed's answer is right, I'll just add that you can also use iterators in select and reject operations with the same syntax he has outlined for "exists" :
[setOfString->select(s : String | s = 'test')]
i.e : variable.operation(iterator | body) . This same syntax exists for all 'iteration' operation : select, reject, collect, exists, forAll, isUnique, one, any and sortedBy.
Though of course, "includes" is better if you only need to check whether you set contains a given value.
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.02969 seconds