Assignment 4 update.

From: R. Clayton <rclayton_at_monmouth.edu>
Date: Wed, 8 Dec 2010 21:08:52 -0500
A couple of people have pointed out to me that I didn't have generics quite
correct for the fourth assignment.  I have finally figured out what they were
saying, and updated the assignment to correct my mistakes:

  There are no more generics in the SortClassifier interface.

  The Sorter interface is no longer generic, and the sort() method is now
  generic. 

I used the initial generics configuration to avoid generic methods, which we
haven't talked about, but that turned out to be the mistake.  Once I understood
that, I also realized that it didn't make any difference because the assignment
doesn't call for implementing Sorter.sort().

To make this point clear, here is an implementation of SortClassifier that
compiles without error using the new definitions:

  $ cat cs.java
  class ClassifySort
  implements SortClassifier {

    public SortClassifier.Advantage
    analyze(Sorter sorter) {

      sorter.sort(new Integer [10]);
      sorter.sort(new String [10]);

      return null;
      }
    }

  $ javac -cp /export/home/class/cs-305/pa4/pa4.jar:. cs.java

  $ 
Received on Wed Dec 08 2010 - 21:09:56 EST

This archive was generated by hypermail 2.2.0 : Sun Dec 12 2010 - 16:38:51 EST