• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Coverting Array to List when i have a int[] array  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a problem whe use the Arrays.asList(an_array). If i have a array of primitives int, What type of List is returned whit the Arrays.asList(my_primitive_type_array) ?

Please, sorry for my poor english, i will try to explain me with an example code:



what code must i to insert in ** for get all the values of the iList variable and print it??

this code dont compile and i dnt nkow why:
 
author
Sheriff
Posts: 23586
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not too sure... but I don't think this...



does what you want. The method takes an array of objects. And since you are not passing it an array of objects, the varargs should make it a single parameter of one int array. (one object)

If you check the size of the returned list, I am willing to bet it is one -- with one entry -- the original int array.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!