public int compareTo(Comment comment) { long primaryKey = comment.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; } Comment comment = null; try { comment = (Comment) obj; } catch (ClassCastException cce) { return false; } long primaryKey = comment.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }