Thank you for lending your time :)
I have a piece of code that sorts Arraylist using compareToIgnoreCase.
Collections.sort(als,new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
//I want to alter this part
int dif=o1.compareToIgnoreCase(o2);
return dif;
}
});
But I want to sort the arraylist in the following manner:
input: (in any order)
sherin
Sherin
SHERIN
bubBle
buBble
BUBBLE
heart
hEart
hEArt
output :
BUBBLE
buBble
bubBle
hEArt
hEart
heart
SHERIN
Sherin
sherin
Could you please help me with this? Thanks in advance :)