Possible Duplicate:
How to determine if a List is sorted in Java?
In java I have array list with names, how do I check if it sorted? I don't want it to be sorted. I just want it to return true if it is and false if it isn't.
So far I have this:
public boolean isSorted()
{
boolean check = false;
if (Collection.sort(bank, Bank.getOwner()).equals(bank))
{
check = true;
}
else
{
check = false;
}
return check;
}
Where getOwner returns the owner name. Obviously I'm doing it wrong.