public Transaction getTransaction(int id) { for (Transaction transaction : transactions) { if (transaction.getId() == id) { return transaction; } } return null; }
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; }
public int createTransaction(Transaction transaction) { transaction.setId(++ID); transactions.add(transaction); return ID; }