I have an array that is initialized like:
Element[] array = {new Element(1), new Element(2), new Element(3)};
I would like to convert this
If the array is of a primitive type, the given answers won't work. But since Java 8 you can use:
int[] array = new int[5]; Arrays.stream(array).boxed().collect(Collectors.toList());