class AccountTransactionOrder {

  public Iterable<Transaction> transactionsToProcess(
      final Transaction nextTransactionInPriorityOrder) {
    deferredTransactions.add(nextTransactionInPriorityOrder);
    final List<Transaction> transactionsToApply = new ArrayList<>();
    while (!deferredTransactions.isEmpty()
        && !transactionsForSender.isEmpty()
        && deferredTransactions.first().equals(transactionsForSender.first())) {
      final Transaction transaction = deferredTransactions.first();
      transactionsToApply.add(transaction);
      deferredTransactions.remove(transaction);
      transactionsForSender.remove(transaction);
    }
    return transactionsToApply;
  }

  public  AccountTransactionOrder(final Stream<Transaction> senderTransactions);

}