public int compareTo(LegalDetails legalDetails) { long primaryKey = legalDetails.getPrimaryKey(); if (getPrimaryKey() < primaryKey) { return -1; } else if (getPrimaryKey() > primaryKey) { return 1; } else { return 0; } }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } LegalDetails legalDetails = null; try { legalDetails = (LegalDetails) obj; } catch (ClassCastException cce) { return false; } long primaryKey = legalDetails.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }