I already know how to sort an ArrayList but I wanna know if this is possible to sort an Array with two arguments like: I have an array 5 same objects with a float and a String in it like that:
- object 1 : 0 "DD"
- object 2 : 3 "FF"
- object 3 : 1 "GG"
- object 4 : 2 "AA"
- object 5 : 1 "AA"
And I want sort them like that:
- object 1 : 0 "DD"
- object 5 : 1 "AA"
- object 3 : 1 "GG"
- object 4 : 2 "AA"
- object 2 : 3 "FF"
Is it possible to sort them with a comparator by multiplying the Float.compare()
and the String.compare()
?
or do you need to sort them first with the Float.compare()
and then create sub-arrays to compare with the String.compare()
?