Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you remove a String [ ] from an ArrayList?

 
Sean Gildea
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an arraylist of String [] , and I need to be able get one at a specific location.

How do I return a complete String [] array from an arraylist?

Here is my code in 2 parts

// String array insertion code into array


And now in another method I am trying to retrieve that String [] from the ArrayList. Can anyone tell me how to do this, or if not, another possible workaround?

Thanks in advance!

 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to cast the return value of the get method to String[].
 
Sean Gildea
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked, thanks!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic