コード例 #1
0
  public Transaction getTransaction(int id) {
    for (Transaction transaction : transactions) {
      if (transaction.getId() == id) {
        return transaction;
      }
    }

    return null;
  }
コード例 #2
0
  public List<Transaction> getTransactionsForAccount(int accountId, TransactionCriteria criteria) {
    List<Transaction> accountTransactions = new ArrayList<Transaction>();

    for (Transaction transaction : transactions) {
      if (transaction.getAccountId() == accountId) {
        accountTransactions.add(transaction);
      }
    }

    return accountTransactions;
  }
コード例 #3
0
 public int createTransaction(Transaction transaction) {
   transaction.setId(++ID);
   transactions.add(transaction);
   return ID;
 }