Skip to content

Instantly share code, notes, and snippets.

@isidore
Created April 28, 2019 15:53
Show Gist options
  • Save isidore/c962c6fbe6a078de83b9c08f6d1ccefe to your computer and use it in GitHub Desktop.
Save isidore/c962c6fbe6a078de83b9c08f6d1ccefe to your computer and use it in GitHub Desktop.

ArrayUtils.addToArray()

Sometimes you wish you could add to an array the same way you can add to a list.

Integer[] numbers = {1, 2, 3};
numbers = ArrayUtils.addToArray(numbers, 4, 5, 6);

will result in a new copy of the array with the added items

Integer[] resulting = {1, 2, 3, 4, 5, 6};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment