Hello,
I'm trying to use URLClassLoader, and to do that I need to take an existing ArrayList<URL> that I have and convert it to URL[].
This can be done simply like this:
I don't understand exactly why I have to pass an array into remoteRepository.toArray(). When I look at the documentation, it says the array passed in is the array in which the list is stored. However, the function also returns an array.
So does this mean if I did this:
Does this mean a and a2 are the exact same reference now? Can somebody explain to me why this function is implemented in such a way?
I'm trying to use URLClassLoader, and to do that I need to take an existing ArrayList<URL> that I have and convert it to URL[].
This can be done simply like this:
URLClassLoader remoteClassLoader = new URLClassLoader (remoteRepositories.toArray (new URL[remoteRepositories.size ()]));
I don't understand exactly why I have to pass an array into remoteRepository.toArray(). When I look at the documentation, it says the array passed in is the array in which the list is stored. However, the function also returns an array.
So does this mean if I did this:
URL[] a = new URL[10];
URL[] a2 = remoteRepositories.toArray(a);
Does this mean a and a2 are the exact same reference now? Can somebody explain to me why this function is implemented in such a way?