is there immutable alternative primitive arrays in java? making primitive array final doesn't prevent 1 doing like
final int[] array = new int[] {0, 1, 2, 3}; array[0] = 42; i want elements of array unchangeable.
not primitive arrays. you'll need use list or other data structure:
list<integer> items = collections.unmodifiablelist(arrays.aslist(0,1,2,3));
Comments
Post a Comment