This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I'm confused how the following code works, AND prints out all 7 elements of the original collection? I would of thought there would been an excepton at the very least?
Senthil Kumaran
Ranch Hand
Joined: Aug 24, 2008
Posts: 32
posted
0
i suggest you to re look the toarray() and aslist() methods again,.,
Paul Stat
Ranch Hand
Joined: Jan 20, 2009
Posts: 50
posted
0
Senthil Kumaran wrote: i suggest you to re look the toarray() and aslist() methods again,.,
Paul Stat wrote:
But what happens to the original String[] array, is it just subject to the garbage collector?
If you are talking about this
String[] sa = new String[3]; // intialise sa to accept 3 String objects
Then yes that string array will be eligible for GC. This is the related statement from the documentation
If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.