reset password
Author Message
dvictor4
Posts: 34
Posted 14:34 Sep 05, 2017 |

Hello I am having trouble understanding the highlighted bullet point:

The Sorting Class:

  • Create a class called Sorting.
  • This class should be designed to prevent its instantiation.
  • This class has one static method called sort.  This method is a generic method that should be designed to sort a SimpleSet.
  • This class should bound its generic to any class that uses the Comparable interface.
    • You may need to review how Comparable works.

 

Does this mean that the generic sort method should only accept a SimpleSet of elements that are comparable OR does this mean that you should only be able to create a SimpleSet of elements that are comparable? 

kknaur
Posts: 540
Posted 16:14 Sep 05, 2017 |

Yes the generic Sort should ONLY allow things that are Comparable. So if the SimpleSet has Comparable items it will work with the method.  The SimpleSet itself can have noncomparable things, but if you were to try to sort them the method invocation would fail with a compile error. 

Last edited by kknaur at 16:15 Sep 05, 2017.
dvictor4
Posts: 34
Posted 16:27 Sep 05, 2017 |

Got it thanks!