<< Chapter < Page | Chapter >> Page > |
Valid index values are positive integers that begin with zero.
Another version of the add method takes a reference to an object as an incoming parameter and appends the specified element to the end of thecollection.
False. Unlike collections that implement the SortedSet interface, the order of the elements in a collection that implements the List interface is not based on the values of the objects referred to by the elements in thelist.
True. For example, the add method of the Set interface stipulates the following:
"Adds the specified element to this set if it is not already present."
On the other hand, the add method of the Collection interface simply states:
"Ensures that this collection contains the specified element."
Thus, the contract for the add method of an object of a class that implements the Set interface is more specialized than the contract for the add method of an object of a class that implements the Collection interface.
False. You can cause the sort order to ignore case by providing an object of a class that implements the Comparator interface, and which defines the compare method and the equals method in such a way as to eliminate case considerations for comparisons of String objects.
True.
False. Implementations of the interface named SortedSet do maintain their elements in sorted order. However, that order is not necessarilyascending. When an object is instantiated from a class that implements the SortedSet interface, the sorting order for that object can be established by providing an object instantiated from aclass that implements the Comparator interface. In that case, the author of the class that implements the Comparator interface determines the order imposed on the elements in the collection.
False. Not all implementations of the Collection interface maintain the elements in ascending sort order. Some may, and others do not. For example,implementations of the List interface (such as ArrayList ) do not maintain their elements in sorted order at all. In other words, the position of an element in an ArrayList does not depend on the value of the element.
True.
False. An ordered collection is one in which each element in the collection has a specific position specified by an index.
False. An ordered collection is not the same as a sorted collection.
True, according to Oracle.
True, according to Oracle.
False.
public class ArrayList<E>extends AbstractList<E>implements List<E>, RandomAccess, Cloneable, Serializable
The Java Collections Framework doesn't provide any direct implementations of the Collection interface. All of the implementations of the interfaces in the Collection hierarchy implement one of the sub-interfaces of the Collection interface. In the case of the ArrayList class, that sub-interface is the List interface, which extends the Collection interface.
True.
False. The TreeSet class is not a direct implementation of the Collection interface. Rather, the TreeSet class is a direct implementation of the SortedSet interface. The SortedSet interface extends the Set interface, and the Set interface extends the Collection interface.
False. A Set object cannot contain duplicate elements, but a List object can contain duplicate elements.
False. One of the trees, which consists of six interfaces, is rooted in the interface named Collection . The other tree, which consists of two interfaces, is rooted in the interface named Map .
True.
This section contains a variety of miscellaneous information.
Financial : Although the Connexions site makes it possible for you to download aPDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.
I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version ofthe module.
In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale onAmazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If youpurchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made andpublished without my prior knowledge.
Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.
-end-
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?