On Aug 4, 7:26 pm, JKid314159 <[email protected]> wrote:
> Re:
> The Java Tutorials:
> Home Page > Collections > Interfaces > List Interface:
> Positional Access and Search Operations
>
>
> Dear Java Programmer:
>
>
> "In fact, this program can be made even shorter and faster. The Arrays class
> has a static factory method called asList, which allows an array to be viewed
> as a List. This method does not copy the array. Changes in the List write
> through to the array and vice versa. The resulting List is not a
> general-purpose List implementation, because it doesn't implement the
> (optional) add and remove operations: Arrays are not resizable. "
>
> I kinda understand the List writes through to the array which means it
> changes the array to a list.
No. When you use the factory method, it is as if you added a tool kit
to the array, but you don't change the array to a List, you simply add
a set of methods to the array, namely the methods of the list
interface.
Actually when you make changes to the list, the list is used to make
the changes to the underlying array (changes are reflected in the
underlying array through the list), and vice versa when you make
changes to the array the changes are reflected to the list, that is
what write through to means here.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---