My array contains items set out like:
"item_name_1::item_description::item_value"
(so each item in the array contains separate pieces of data which is later split at "::")
and my question is, how can i sort the array by the "ITEM_VALUE" (which is a numeric value), i have tried the following, with no luck:
Arrays.sort(inputArr, new Comparator<String>() {
@Override
public int compare(String entry1, String entry2) {
String[] entry1Split = entry1.split("::");
String[] entry2Split = entry2.split("::");
return entry1Split[2].compareTo(entry2Split[2]);
}
});