Not with primitive arrays. You’ll need to use a List or some other data structure:
List<Integer> items = Collections.unmodifiableList(Arrays.asList(0,1,2,3));
More Related Contents:
- How does array work? How to create a basic array data structure using java? [closed]
- How to check two array list are same content in same position
- error: incompatible types: ‘Something’ cannot convert to ‘Something’
- Do Java arrays have a maximum size?
- Java arrays printing out weird numbers and text [duplicate]
- How to convert Java String into byte[]?
- Sort a two dimensional array based on one column
- Comparing two integer arrays in Java
- What is the diamond operator in Java? [duplicate]
- Java, find intersection of two arrays
- Java: Finding the highest value in an array
- Passing directly an array initializer to a method parameter doesn’t work
- Find an array inside another larger array
- how to write an array to a file Java
- Java: Reading integers from a file into an array
- Sort ArrayList of Array in Java
- Gets byte array from a ByteBuffer in java
- Mutable objects and hashCode
- Will the jit optimize new objects
- Arrays.asList() of an array
- How does the enhanced for statement work for arrays, and how to get an iterator for an array?
- Converting char[] to byte[]
- Convert a 2D array index into a 1D index
- What does java.lang.ArrayIndexOutOfBoundsException mean? [duplicate]
- How to convert byte[] to Byte[] and the other way around?
- Random element from string array [closed]
- Array of function pointers in Java [duplicate]
- Why are Integers immutable in Java?
- What is difference between mutable and immutable String in java
- Why does byteArray have a length of 22 instead of 20?