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

1 Expert Approved Answer
Step: 1 Unlock

a b The two obvious choices neither of whi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Language Pragmatics Questions!