I have a primitive type array from which I want to remove an element at the specified index. What is the correct and efficient way to do that?
I am looking to remove the element in the way mentioned below
long[] longArr = {9,8,7,6,5};
int index = 1;
List list = new ArrayList(Arrays.asList(longArr));
list.remove(index);
longArr = list.toArray(); // getting compiler error Object[] can't be converted to long[]
but the above approach looks to work with with Object only not with primitives.
Any alteative to that? I can not use any third party/additional libraries
Thanks
