Reputation: 328674
How do I create a variable with type List<String>
in Xtend?
var list = Lists::newArrayList()
list.add( "xxx" )
doesn't work; the type in the add()
isn't propagated back.
var list = Lists::newArrayList() as List<String>
gives an exception at runtime.
How do I create lists of a certain type in Xtend?
Upvotes: 2
Views: 3373
Reputation: 6729
Which version of Xtend do you use?
var list = newArrayList
list.add('')
works for me (2.4.3).
Also var List<String> list = newArrayList
will do the trick.
Upvotes: 4