I have a list of objects
List<Label> toReturn = new ArrayList<Label>();
toReturn.add(new Label("hbc"));
toReturn.add(new Label("Abc"));
toReturn.add(new Label("dbc"));
toReturn.add(new Label("0%"));
toReturn.add(new Label("10%"));
toReturn.add(new Label("20%"));
toReturn.add(new Label("40%"));
toReturn.add(new Label("100%"));
Label pojo has string property label . I want to sort the list alphabetically. Percentages should appear first in increasing manner followed by alphabets in case insensitive manner
I have used the snippet
toReturn.sort(Comparator.comparing(Label::getLabel, String.CASE_INSENSITIVE_ORDER));
which sorts the list with elements having property label in order "0%","10%","100%","20%","40%","Abc","dbc","hbc"
But I want in the order "0%","10%","20%","40%","100%","Abc","dbc","hbc"
How do I solve this ?