import java.util.Comparator; /** * A merge sort implementation * @author gtowell * created: April 15, 2020 */ @SuppressWarnings("unchecked") public class MergeObj { /** * Merge the two lists * @param list1 the first list, sorted * @param list2 the second list, sorted * @return a new list (array) containing all of the eleents of lsist1 and list2, sorted. */ private K[] domerge(K[] list1, K[] list2, Comparator c) { K[] rtn = (K[])new Object[list1.length + list2.length]; int locr=0, loc1=0, loc2=0; while (loc1 c) { K[] aa = doMergeSort(list, 0, list.length-1, c); // change the contents of the provided array for (int i=0; i c) { if (eend==strt) { K[] tmp = (K[])new Object[1]; tmp[0]=list[strt]; return tmp; } if (eend mos = new MergeObj<>(); mos.sortInPlace(sss, Student.nameComparator()); mos.sortInPlace(sss, Student.yearComparator()); System.out.println(); for (Student s : sss) { System.out.println(s); } } }