@Test void testCompare() { assertThat(priorityComparator.compare(foo, bar)).isGreaterThan(0); List<Object> objects = Arrays.asList(foo,bar); objects.sort(priorityComparator); assertThat(objects).containsExactly(bar, foo); }
@Override public int compare(final Object o1, final Object o2) { int o1Priority = getPriority(o1); int o2Priority = getPriority(o2); return o2Priority - o1Priority; }
PriorityComparator implements Comparator<Object> { @Override public int compare(final Object o1, final Object o2) { int o1Priority = getPriority(o1); int o2Priority = getPriority(o2); return o2Priority - o1Priority; } }
PriorityComparator implements Comparator<Object> { @Override public int compare(final Object o1, final Object o2) { int o1Priority = getPriority(o1); int o2Priority = getPriority(o2); return o2Priority - o1Priority; }  }
PriorityComparator implements Comparator<Object> { @Override public int compare(final Object o1, final Object o2) { int o1Priority = getPriority(o1); int o2Priority = getPriority(o2); return o2Priority - o1Priority; }  @Override int compare(final Object o1, final Object o2); }
PriorityComparator implements Comparator<Object> { @Override public int compare(final Object o1, final Object o2) { int o1Priority = getPriority(o1); int o2Priority = getPriority(o2); return o2Priority - o1Priority; }  @Override int compare(final Object o1, final Object o2);  }