|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
- Which two of the following interfaces are at the top of the hierarchies in the Java Collections Framework?
SetMapQueueSortedMapCollectionList- Which of the following interfaces does not allow duplicate objects?
QueueSetList- In order for objects in a
Listto be sorted, those objects must implement which interface and method?- True or false: The
elementmethod alters the contents of aQueue.
Check your answers.
- Write a method with the signature:
that (1) traverses through the elements inpublic Collection<String> filter(Collection<String> c)cusing anIterator, (2) checks whether each element meets a certain condition (in a separate methodconditionwhich you do not need to define right now), and (3) if the object meets the condition, adds it to the newCollectionto return. The method should not modify theCollection c. Design the method to work on any collection ofStrings. Only theconditionmethod should have application-specific code; we will define this method as part of an application in the exercises for the Implementations lesson.- Write a method with the signature:
that returns a newpublic List<Integer> reverse(List<Integer> orginalList)Listthat contains the sameIntegerobjects as theoriginalListargument, but in reverse order. The method should not modify theorginalListobject.
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.