Yes, you should make a Comparator for each. Docs
public final class MyComparator implements Comparator<String>
{
@Override
public int compare(String a, String b)
{
//Return +1 if a>b, -1 if a<b, 0 if equal
}
}
For your days of the week you might want to make your comparator similar to this;
public final class MyComparator implements Comparator<String>
{
private String[] items ={
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
};
@Override
public int compare(String a, String b)
{
int ai = items.length, bi=items.length;
for(int i = 0; i<items.length; i++)
{
if(items[i].equalsIgnoreCase(a))
ai=i;
if(items[i].equalsIgnoreCase(b))
bi=i;
}
return ai-bi;
}
}
Then to sort your arraylist according to your custom order;
MyComparator myComparator = new MyComparator();
Collections.sort(myArrayList, myComparator);
You can call Collections.sort() without the 2nd parameter if you need the default ordering of the type (If it implements comparable). Docs