Continuing Example C 7.59, the call csNames.consider(null); will generate a run-time exception, because String. compare To is

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 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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: