I have a list of words sorted using g_ascii_strcasecmp function. I need to process this list in java. What is the equivalent sorting function in java? In order to implement binary search I need a correct comparison function. So far I have the function below but it is not always produces the correct result.
public int compareStrings(String str) {
Collator collator = Collator.getInstance();//TODO: implement locale?
return collator.compare(this.wordString, str);
}
UPDATE. List example: “T, t, T’ai Chi Ch’uan, t’other, T-, T-bone, T-bone steak, T-junction, tabasco, Tabassaran, tabby”.
I decided to share the method I came up with: