jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How Do I Create An Array That Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How Do I Create An Array That "Backs" a List?" Watch "How Do I Create An Array That "Backs" a List?" New topic
Author

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

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

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
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
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.)
 
Consider Paul's rocket mass heater.
 
subject: How Do I Create An Array That "Backs" a List?
 
Similar Threads
access array
delete an element from an array
How to automatically change the page contents with change in drop down list option selection
javascript
How to sort Arraylist without Sort method