This commit is contained in:
@@ -6,13 +6,15 @@ import java.util.LinkedList;
|
||||
/**
|
||||
* This class gets two linked lists, and compares their first value alphabetically.
|
||||
*/
|
||||
public class MessageCommandAliasesComparator implements Comparator<LinkedList<String>> {
|
||||
public class MessageCommandAliasesComparator implements Comparator<LinkedList<String>>
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(LinkedList<String> linkedList, LinkedList<String> t1) {
|
||||
public int compare(LinkedList<String> linkedList, LinkedList<String> t1)
|
||||
{
|
||||
|
||||
if(linkedList.isEmpty()) return 0;
|
||||
if(t1.isEmpty()) return 0;
|
||||
if (linkedList.isEmpty()) return 0;
|
||||
if (t1.isEmpty()) return 0;
|
||||
|
||||
return linkedList.get(0).compareTo(t1.get(0));
|
||||
}
|
||||
|
@@ -7,10 +7,12 @@ import java.util.Comparator;
|
||||
/**
|
||||
* This class gets two trivia categories, and compares them by their name.
|
||||
*/
|
||||
public class TriviaCategoryComparator implements Comparator<TriviaCategory> {
|
||||
public class TriviaCategoryComparator implements Comparator<TriviaCategory>
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(TriviaCategory o1, TriviaCategory o2) {
|
||||
public int compare(TriviaCategory o1, TriviaCategory o2)
|
||||
{
|
||||
return CharSequence.compare(o1.categoryName(), o2.categoryName());
|
||||
}
|
||||
}
|
||||
|
@@ -7,10 +7,12 @@ import java.util.Comparator;
|
||||
/**
|
||||
* This class gets two trivia scores, and compares their score.
|
||||
*/
|
||||
public class TriviaScoreComparator implements Comparator<TriviaScore> {
|
||||
public class TriviaScoreComparator implements Comparator<TriviaScore>
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(TriviaScore o1, TriviaScore o2) {
|
||||
public int compare(TriviaScore o1, TriviaScore o2)
|
||||
{
|
||||
return Integer.compare(o2.getScore(), o1.getScore()); // inverted, because higher number should come first
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user