private List<Transaction> combineTransactions(List<ConstrainedTransaction> transactions) {
        List<Transaction> combinedTransactions = new ArrayList<>(transactions.size());
        for (List<Transaction> combinableTransactions :
                transactions.stream().map(ConstrainedTransaction::transaction).
                        collect(Collectors.groupingBy(Transaction::getClass)).values()) {
            Transaction combinedTransaction = combinableTransactions.get(0);
            for (int i = 1; i < combinableTransactions.size(); i++)
                combinedTransaction = combinedTransaction.add(combinableTransactions.get(i).operations());
            combinedTransactions.add(combinedTransaction);
        }
        return combinedTransactions;
    }
Combines all transactions of the same type to one
vespajlib/src/main/java/com/yahoo/transaction/NestedTransaction.java