Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to sort vector of items in android while targeting api level 15?

I am trying to sort vector of items using comparator in android. I tried:

vector.sort(new myComparator());

but it shows error:

Call requires API level 24 (current min is 15): java.util.Vector#sort

Any solution to it??

like image 526
Monu Kumar Avatar asked Dec 26 '17 07:12

Monu Kumar


1 Answers

Use Collections.sort() -

Collections.sort(vector, new myComparator());

Also think about using ArrayList<> instead of Vector - Vector is deprecated

like image 183
PPartisan Avatar answered Nov 03 '22 02:11

PPartisan