コード例 #1
0
  public int compareTo(Subscription subscription) {
    long primaryKey = subscription.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    Subscription subscription = null;

    try {
      subscription = (Subscription) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = subscription.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }