There is an object like this:
dataObj
=============
name
address
isTopPriority
So I have an arrayList of dataObj, how to sort the dataObj to "if isTopPriority is true, then they will be the fronter part of the array" ? Thanks
Attempt the code like:
private class CustomComparator implements Comparator<Spot> {
@Override
public int compare(Spot lhs, Spot rhs) {
// TODO Auto-generated method stub
return lhs.isStar.compareTo();
}
}
But I am confused about why to compare between 2 object , I would like to comapre like this:
just if (currentObj.isFirstPriority == true) then return the object
.
Thanks for helping