Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jul 11, 2013
1 parent ed4dfe0 commit 8585cc6
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*/
public class WeightedComparator implements Comparator<Weighted>
public enum WeightedComparator implements Comparator<Weighted>
{
public static final Comparator<Weighted> INSTANCE = new WeightedComparator();

private WeightedComparator()
{
}
INSTANCE;

@Override
public int compare(final Weighted left, final Weighted right)
Expand All @@ -29,7 +25,9 @@ public int compare(final Weighted left, final Weighted right)
{
return 0;
}
return ((Integer) left.priority()).compareTo(right.priority());
int thisVal = left.priority();
int anotherVal = right.priority();
return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
}

}

0 comments on commit 8585cc6

Please sign in to comment.