SnomedCodeComparator implements Comparator<SnomedConcept> { public int compare(final SnomedConcept o1, final SnomedConcept o2) { if (o1 == o2) return 0; if (o1 != null) { if (o2 == null) return 1; else return new BigInteger(o1.snomedId) .compareTo(new BigInteger(o2.snomedId)); } return -1; }  int compare(final SnomedConcept o1, final SnomedConcept o2);  }
@Test public void testCompare() throws Exception { final List<SnomedConcept> sorted = new ArrayList<>(TestData.TEST_DATA); Collections.sort(sorted, new SnomedCodeComparator()); for (int i = 0; i < sorted.size(); i++) { assertEquals(sorted.get(i).candidateScore, i); } }