pass array as argument without first element java

jennifer lawrence :

I want to pass an array as argument to a function without first element.

I came up with this solution, but I'm wondering if there are better ways to it.

List<Integer> numbers = new ArrayList<>();
//... in the meantime numbers is an array that contain 1000 elements;
numbers.remove(0);
myFunction(numbers)
tostao :

You can use subList(firstElement, lastElement); method.

Here please check javadoc.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=329098&siteId=1