2

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?

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820

1 Answers1

4

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.

Sebastian Zarnekow
  • 6,609
  • 20
  • 23