This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections - toArray Method

 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Collection Documentation States:
"The toArray methods are provided as a bridge between collections and older APIs that expect arrays on input. They allow the contents of a Collection to be translated into an array. The simple form with no arguments creates a new array of Object. The more complex form allows the caller to provide an array or to choose the runtime type of the output array."
When toArray is called, and the collection is "translated" to the array, do the objects still exist in the LinkedList.
Can I call toArray on the same LinkedList multiple times to create arrays with different names but containg the same set of objects?
Thanks,
Landon
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling toArray() doesn't change a collection in any way, so the answer to both your questions is "yes".
 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest...That's what I suspected.
Landon
[ May 06, 2004: Message edited by: Landon Blake ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic