I am trying to write a Java function which has List object as output parameter.
boolean myFunction(int x, in y, List myList)
{
...Do things...
myList=anotherList.subList(fromIndex, toIndex);
return true
}
Before that I call the function I declare myList as follow: List myList=null; Then I call the function myFunction(x,y,myList) But when I try to manipulate myList, I find that myList is still null.
I am sure the variable "antherList" in my function code is not null and I am sure that the subList function return a non-empty List.
What is the reason, and how can pass a List as output parameter in a Java function? Thank you very much.