6

How can I declare an array of int in xtend?

I've tried ArrayList but I get the error "The primitive 'int' cannot be a type argument".

chris yo
  • 1,187
  • 4
  • 13
  • 30

1 Answers1

8

Please refer to the docs for details, but essentially its something along these lines:

val int[] x = newIntArrayOfSize(5)

or if you want to define an array literal:

val int[] x = #[1, 2, 3]
Sebastian Zarnekow
  • 6,609
  • 20
  • 23
  • I am still getting error, the method newIntArrayOfSize is not defined for the type calculatorClass. I have already imported java.lang.Object. What library should I import? – chris yo Aug 21 '13 at 02:49
  • The method newIntArrayOfSize is new in Xtend 2.4. Which version do you use? – Sebastian Zarnekow Aug 24 '13 at 14:41