public int compareTo(Object otherTick) { if (!(otherTick instanceof Tick)) { throw new ClassCastException("Not a valid Tick object!"); } Tick tempTick = (Tick) otherTick; if (this.getTimeStamp() > tempTick.getTimeStamp()) { return 1; } else if (this.getTimeStamp() < tempTick.getTimeStamp()) { return -1; } else { return 0; } }