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:
“Every morning I woke in dread, waiting for the day nurse to go on her rounds and announce from the list of names in her hand whether or not I was for shock treatment, the new and fashionable means of quieting people and of making them realize that orders are to be obeyed and floors are to be polished without anyone protesting and faces are to be made to be fixed into smiles and weeping is a crime.”
—Janet Frame (b. 1924)