Question: Continuing Example C 7.59, the call csNames.consider(null); will generate a run-time exception, because String. compare To is not designed to take null arguments. (a) Modify
Continuing Example C 7.59, the call
csNames.consider(null);
will generate a run-time exception, because String. compare To is not designed to take null arguments.
(a) Modify Figure C 7.6 to guard against this possibility by including a predicate public Boolean valid(T a); in the Chooser interface, and by modifying consider to make an appropriate call to this predicate. Modify class Case Sensitive accordingly.
(b) Suggest how to make similar modifications to the C# Arbiter of Figure C 7.8 and Example C 7.66. How should you handle lower bounds when you need both Better and Valid?
Step by Step Solution
3.47 Rating (163 Votes )
There are 3 Steps involved in it
a b The two obvious choices neither of whi... View full answer
Get step-by-step solutions from verified subject matter experts
