I have javascript code like this:
var myArray = []; //integer
var anIndex = 1;
Array.prototype.delete = function (index) {
var rest = this.slice(index + 1);
this.length = index;
return this.push.apply(this, rest);
};
and used like this:
myArray.delete(anIndex);
How to translate it into java code?
delete anArray[idx], or why not slice the array in de first place? Why augment the prototype (which is considered bad practice)? besides: questions asking to rewrite a snippet in another language are considered off-topic