Declaring an array of int in xtend
Asked Answered
P

1

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".

Pipsissewa answered 26/7, 2013 at 5:32 Comment(1)
,I am missing the code you triedFanestil
L
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]
Ludicrous answered 26/7, 2013 at 6:38 Comment(2)
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?Pipsissewa
The method newIntArrayOfSize is new in Xtend 2.4. Which version do you use?Ludicrous

© 2022 - 2024 — McMap. All rights reserved.