jeudi 9 mars 2017

compareTo method for a linkedList?

Instructions: enter image description here

My tests seem to be passing, but not sure if I am covering all the cases or possibility. I feel my implementation is too simple. Can someone please examine. Thank you

My implementation:

@Override
public int compareTo(ListNoOrder<T> otherList){
int sizeCompare = otherList.sizeOfList;
if (this.sizeOfList > sizeCompare) {
return 1;
} else if (this.sizeOfList < sizeCompare) {
return 1;
} else {
return 0;
}
}

Aucun commentaire:

Enregistrer un commentaire