| CIT 594 Second Midterm Spring 2003, Dave Matuszek |
Name _______________________________________
|
Please keep all answers brief and to the point. I like answers to the question that I asked, and would prefer not to read everything you know about the general subject area.
getLeftChild()
Mutative transformer setLeftChild(BinaryTree)
Accessor getValue()
Mutative transformer setValue(Object)assert statement, rather than throwing one of the more
traditional kinds of Exception?Set, or from a Vector? Why?binarySearch method? ArraysListIterator
object in addition to those provided by an Iterator object?![]() |
Collection Map
/ \ |
/ \ |
Set List SortedMap
|
|
SortedSet
|
Employee class, and now you want to create
a Hashtable using Employee objects as keys. hashCode() method
for Employees. How will this be used?equals(Object) method for
Employees. How will this be used?equals(Object) method? Why or why not?hashCode(Object)
method? Why or why not? equals(Object) and hashCode(),
what is the one relationship between the two methods that you must
be sure to satisfy?Collection interface (C), the Map interface
(M), both (B), or neither (N). Hint: The commonsense answer is probably the
correct one.
B isEmpty()C iterator()M get(Object)C contains(Object)N hasNext()
Comparable or Comparator? v containing several objects.
What is the effect of the following statement? v = new Vector(new TreeSet(v));
Here's
a small portion of a road map. The names represent towns, and the lines represent
roads between those towns. The number along each line represents the distance
(in miles) along that road between the two towns that it connects. There is
never more than one road connecting two towns. This map will be created once,
rarely or never modified, and used frequently to determine the best (shortest)
route between two towns. You can assume a small number of towns (< 100)
and that each town has a uinque name.