I am doing this assignment where we have to create 2 types of object,
public class Person implements Cloneable, Comparable<Person>
and
public class Book implements Cloneable, Comparable<Book>
The main task of this program is to sort the two types using its own compare functions as following:
compareTo(Person o)
compareTo(Book o)
So, I created 2 ListArray as following in the main function to store the book and person objects as following:
List<Book> bookArray = new ArrayList<Book>();
List<Person> peopleArray = new ArrayList<Person>();
And I have my sorting algorithm implemented in another class like the following:
public class Sort{
Comparable<Object>[] values;
public Sort(List<Object> inputArray) {
this.values = (Comparable<Object>[]) inputArray.toArray();
}
public doSort() {
//sort implementation...
}
The problem is when calling this function using the arrays above
Sort sorter = new Sort(peopleArray);
sorter.doSort();
Eclipse shows the error saying "The constructor Sort(List) is undefined." What am I doing wrong here? Thank you in advance.
public class Sort extends {extends what?List<Person> peopleArray = ArrayList<Person>;