class PendingTransactionFilter {

  public Set<Transaction> reduce(
      final Set<TransactionInfo> pendingTransactions, final List<Filter> filters, final int limit)
      throws InvalidJsonRpcParameters {
    return pendingTransactions.stream()
        .filter(transactionInfo -> applyFilters(transactionInfo, filters))
        .limit(limit)
        .map(TransactionInfo::getTransaction)
        .collect(Collectors.toSet());
  }

}