public int compareTo(Vertical vertical) { int pk = vertical.getPrimaryKey(); if (getPrimaryKey() < pk) { return -1; } else if (getPrimaryKey() > pk) { return 1; } else { return 0; } }
public boolean equals(Object obj) { if (obj == null) { return false; } Vertical vertical = null; try { vertical = (Vertical) obj; } catch (ClassCastException cce) { return false; } int pk = vertical.getPrimaryKey(); if (getPrimaryKey() == pk) { return true; } else { return false; } }