Lists August 13, 2008
Posted by crystalchangdin in education and career in Sweden.trackback
A list is a container that holds a finite sequence of reference values, all of the same type. (We will say “list of object” rather than a “list of references,” but we should remember that the list’s components are references to the “contained” objects.)
- A list is finite. In particular , a list might contain just one element or it might contain no elements at all. If a list does not contain any elements, it is said to be empty.
- A list is a sequence. That is, assuming there are several elements on the list, there is a first element, a second element, and so forth.
- A list is homogeneous. All the elements of a list are of the same type.
Furthermore, as we mentioned above, a list can contain multiple instances of an item: the same reference value might occur several times on the list. What we mean is that it is possible to add an item to a list more than once. There is nothing in the list mechanism to prevent it. But in many cases it will not make sense for an item to appear more than once on a list. For example, a student should not appear more than once on a list of student enrolled in a course.
Comments»
No comments yet — be the first.