Okay so here are the two methods I'm having issues with. I need to sort two arrays ingoring case. I thought it would be as simple as chaning the compareTo -->compareToIgnoreCase. But when I do this the compiler tells me
SortSearchUtil.java:63: cannot find symbol
symbol : method compareToIgnoreCase(java.lang.Comparable)
location: interface java.lang.Comparable
if(array[searcher].compareToIgnoreCase(array[rs])<0)
Please help
public static int binarySearch(Comparable[]array, Comparable target) { int min, mid, max; min = 0; max = array.length-1; int found = -1; do { mid =(max+min)/2; if(array[mid].compareTo(target)<0) min=mid+1; else if(array[mid].compareTo(target)>0) max=mid-1; else {found = 1; return mid;} }while(found == (-1) && min <= max); return found; } public static void sortAddresses(Comparable [] array)// class create will own compareto method. geraric { int ms, rs, searcher; Comparable temp; for(ms = 0; ms<array.length-1; ms++) { rs = ms; for(searcher = ms+1; searcher<array.length;searcher++) { if(array[searcher].compareToIgnoreCase(array[rs])<0)//based on the type of the object making the call. rs = searcher; } temp = array[ms]; array[ms] = array[rs]; array[rs] = temp; } }//end method