• 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

How Do I Create An Array That "Backs" a List?  RSS feed

 
Ranch Hand
Posts: 693
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The is question 6d from the "OCP Practice Exams" by K&B page 151

6.d Create a List of Longs. Create an array that "backs" the List. Change a value in the List and display the contents of the array. Change a value in the array and display the contents of the List. Attempt to add a new entry to the List.

I believe that I was able to create a List that backs an array by using the asList() method, but I don't know how to create an array that backs a list.

Thanks for reading my post.

-- Kaydell
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just means to create the List of Longs by creating a Long[] array and then using Arrays.asList.

The first lines of Arrays.asList javadoc:

Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.)

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!