Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

ArrayList containing array of objects  RSS feed

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an arraylist whose each element is a fixed size array of object

Wwe dont have any API to retrive array of object from ArrayList
and therefore I was wondering who can we retrieve each element as an array
from arraylist

If any one has any idea please help

 
Sheriff
Posts: 23867
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is hardly an advanced topic. Just cast from Object to Thing[], or whatever it's an array of:
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


We dont have any API to retrive array of object from ArrayList


We can however retrieve an Object from an ArrayList, and if that Object is an array, we can cast it to an array and use it.
 
Marshal
Posts: 61709
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using the latest versions of Java (5+) you shouldn't be messing abouit with casts in the first place. Take all the casting out, and declare your List as generic.becomesTry it and see.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!