How do I define a constant array of ints? In Java, I would do the following. Ideally, I would like to to take advantage of Fantom's const qualifier (which Java doesn't have).
protected final static int[] exampleArray = { 3, 4, 5, 6, 7 };
Sure it is.
a:= [1,2,3,4] [1,2,3,4] b:= [1,2,3,4].toImmutable [1,2,3,4] a.add(5) [1,2,3,4,5] b.add(0) sys:ReadonlyErr: List is readonly
If your want your fields to be immutable declare then static and const (in fact all static field must be const).
static
const
works perfectly. thanks!
Login or Signup to reply.
claytonwohl Thu 12 Jan 2012
How do I define a constant array of ints? In Java, I would do the following. Ideally, I would like to to take advantage of Fantom's const qualifier (which Java doesn't have).
DanielFath Thu 12 Jan 2012
Sure it is.
If your want your fields to be immutable declare then
static
andconst
(in fact all static field must be const).claytonwohl Fri 13 Jan 2012
works perfectly. thanks!