<< Chapter < Page | Chapter >> Page > |
True or False? The program shown in Listing 1 compares the search speed of the ArrayList class and the TreeSet class.
True or False? The program shown in Listing 1 instantiates a TreeSet object and populates it with approximately 10,000,000 elements.
True or False? Because the add method of a Set object rejects duplicate elements, there may be fewer than 2,000,000 elements in the TreeSet object in Listing 1 after it is populated, depending on how many of the random values are duplicates.
True or False? One of the capabilities of the Collection Framework is to create a new Collection object and populate it with the contents of an existing Collection object of a different (or the same) actual type.
True or False? The code in Listing 1 instantiates an ArrayList object and populates it with exactly 2,000,000 random values that are different from the random valuescontained in the TreeSet object.
True or False? The ArrayList object in Listing 1 may contain duplicate values.
True or False? Listing 1 calls the get method on the ArrayList object. The ArrayList class implements the List interface. The get method of the List interface is inherited from the Collection interface.
True or False? In general, the time required for the contains method to find a value in a TreeSet object is less than the time required for the contains method to find a value in an ArrayList object.
True or False? The very fast searching speed of a TreeSet object results from the implementation of the Set interface.
True or False? Polymorphic behavior means that the actual method that is executed on a Collection object is the appropriate method for that type of object regardless of the actual type (class) of the reference to the object.
True or False? Some of the implementations of the Java Collections Framework maintain their elements in a random order, and other implementations maintaintheir elements in a sorted order. The sorting algorithms used to maintain the order of the collections in the Collections Framework are exposed in the sameway that the search algorithm is exposed (via the contains method).
True or False? The interfaces in the Collections Framework make it possible to manipulate the contents of collections in a manner that is independent of the underlying implementation of each collection.
What is the meaning of the following two images?
These images were inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.
This image was also inserted for the purpose of inserting space between the questions and the answers.
True.
False. The sorting algorithms used to maintain the order of the collections in the Collections Framework are not exposed in the way that the searchalgorithm is exposed (via the contains method). Rather, the sorting algorithms are implicit in those implementations that need them, and are absent from thoseimplementations that don't need them.
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?