Пример #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;
 }