code: public static TransactionAware of(Collection<TransactionAware> transactionAwares) {
      // this is most common case, trying to optimize
      if (transactionAwares.size() == 1) {
        return transactionAwares.iterator().next();
      }
  
      TransactionAwareCollection result = new TransactionAwareCollection();
      result.addAll(transactionAwares);
  
      return result;
    }
docs: Create composite transaction aware object that delegates transaction logic to given collection of
  {@link TransactionAware}s
  @param transactionAwares collection of {@link TransactionAware}s
  @return instance of {@link TransactionAware}