コード例 #1
0
  public int compareTo(TonGiao tonGiao) {
    int value = 0;

    if (getId() < tonGiao.getId()) {
      value = -1;
    } else if (getId() > tonGiao.getId()) {
      value = 1;
    } else {
      value = 0;
    }

    if (value != 0) {
      return value;
    }

    return 0;
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    TonGiao tonGiao = null;

    try {
      tonGiao = (TonGiao) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = tonGiao.getPrimaryKey();

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