Search Results

Search found 1 results on 1 pages for 'user150505'.

Page 1/1 | 1 

  • Passing parametrized ArrayList to a function in java

    - by user150505
    I have the following fucntion. func(ArrayList <String> name) { ........ } The function fills the ArrayList. (I don't want to return the ArrayList) However, in the caller function the ArrayList obtained has all items of ArrayList as null. For eg. 1 name = new ArrayList[num]; 2 func(name); 3 System.out.println(name[0]); I get NullPointerException at line 3. Is this because of line 1, i.e. I am not parametrizing? If yes, is there another way this can be done? Because java does not allow creating a generic array of parametrized ArrayList.

    Read the article

1