예제 #1
0
  @Override
  public int compareTo(BudgetItem budgetItem) {
    long primaryKey = budgetItem.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
예제 #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (!(obj instanceof BudgetItem)) {
      return false;
    }

    BudgetItem budgetItem = (BudgetItem) obj;

    long primaryKey = budgetItem.getPrimaryKey();

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