Skip to content

Instantly share code, notes, and snippets.

@erkanzileli
Last active April 4, 2019 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erkanzileli/411736d41c7125b80b38a089741e8f1a to your computer and use it in GitHub Desktop.
Save erkanzileli/411736d41c7125b80b38a089741e8f1a to your computer and use it in GitHub Desktop.
Delete an element from an array
public static Object[] delete(Object[] array, int index) {
Object[] newArray = new Object[array.length - 1];
for (int i = 0; i < array.length; i++) {
if (i == index)
continue;
newArray[i] = array[i];
}
return newArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment