Class intComparable


public class intComparable
extends comparable

The intComparable class is an extension of comparable class with the additional property that the list consists of Int objects. As a result we also need to provide a concrete implementation of the comp method which will overwrite the super class's comp. One point to consider is that since in the comparable class the list is made of Object types in its extensions, we have to use special kinds of Onject entries. String is a kind of Object but primitive types like int, char or float are not. Instead we use the wrapper class Integer, a class with a single data field of type int and a bunch of useful methods. This is is a handy trick and we may have to use it many times in the future where objects are needed but we have only primitive data types. The source code

Fields inherited from class comparable
Constructor Summary
intComparable(java.lang.Integer[] list)
Method Summary
 int comp(java.lang.Object I, java.lang.Object J)
Methods inherited from class comparable
getListItem, setListItem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public intComparable(java.lang.Integer[] list)
Method Detail


public int comp(java.lang.Object I,
                java.lang.Object J)