Java Collections Framework - List Interface

List Interface

Lists are implemented in the JCF via the java.util.List interface. It defines a list as essentially a more flexible version of an array. Elements have a specific order, and duplicate elements are allowed. Elements can be placed in a specific position. They can also be searched for within the list. Two concrete classes implement List. The first is java.util.ArrayList, which implements the list as an array. Whenever functions specific to a list are required, the class moves the elements around within the array in order to do it. The other implementation is java.util.LinkedList. This class stores the elements in nodes that each have a pointer to the previous and next nodes in the list. The list can be traversed by following the pointers, and elements can be added or removed simply by changing the pointers around to place the node in its proper place.

Read more about this topic:  Java Collections Framework

Famous quotes containing the word list:

    The advice of their elders to young men is very apt to be as unreal as a list of the hundred best books.
    Oliver Wendell Holmes, Jr. (1841–1935)