Making Collections.binarySearch() work with compareToIgnoreCase?
问题 So I am searching a huge ArrayList for a particular String value, but I need Collections.binarySearch() to return a value >=0 if the String I am looking for is equal( non case-sensitive) to the String I pass into the binarySearch() method. Now in the source code for Collections.binarySearch(), it eventually calls the following lines of code. Comparable<? super T> midVal = list.get(mid); int cmp = midVal.compareTo(key); So seen as I cannot override String as its final (therefore preventing me