Java - What's the most efficient way of removing a set of elements from an Array[]
- by fraido
I've something like this
Object[] myObjects = ...(initialized in some way)...
int[] elemToRemove = new int[]{3,4,6,8,...}
What's the most efficient way of removing the elements of index position 3,4,6,8... from myObjects ?
I'd like to implement an efficient Utility method with a signature like
public Object[] removeElements(Object[] object, int[] elementsToRemove) {...}
The Object[] that is returned should be a new Object of size myObjects.length - elemToRemove.length