I have an initial array, array1 which contains 30 elements and need to create a new array array2 containing elements 0-14 from array1.
I'm using IntStream as the mapper for the array index. But the following gives errors:
Object[] array2 = IntStream.range(0,14).map(x -> (Object)array1[x]).toArray(Object[]::new);
Error on (Object)array1[x]:
The type of the expression must be an array type but it resolved to List<Object[]>