Source:
<code>protected List retrieveTransactions() { <START> List groupedTransactions = new ArrayList(); <END> List transactions = (List) businessObjectService.findMatchingOrderBy(CorporateBilledCorporatePaidTransaction.class, new HashMap(), KFSPropertyConstants.TRANSACTION_CREDIT_CARD_NUMBER, true); boolean singleTransaction = parameterService.getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, SINGLE_TRANSACTION_IND_PARM_NM); List documentTransactions = new ArrayList(); if (singleTransaction) { for (Iterator iter = transactions.iterator(); iter.hasNext(); ) { documentTransactions.add(iter.next()); groupedTransactions.add(documentTransactions); documentTransactions = new ArrayList(); } } else { Map cardTransactionsMap = new HashMap(); for (Iterator iter = transactions.iterator(); iter.hasNext(); ) { CorporateBilledCorporatePaidTransaction transaction = (CorporateBilledCorporatePaidTransaction) iter.next(); if (!cardTransactionsMap.containsKey(transaction.getTransactionCreditCardNumber())) { cardTransactionsMap.put(transaction.getTransactionCreditCardNumber(), new ArrayList()); } ((List) cardTransactionsMap.get(transaction.getTransactionCreditCardNumber())).add(transaction); } for (Iterator iter = cardTransactionsMap.values().iterator(); iter.hasNext(); ) { groupedTransactions.add(iter.next()); } } return groupedTransactions; }</code><technical_language>This method is a lot of raw types, PCDO code this based well. This method a lot cleaner if generics possible. (The return type in method declaration need raw, superclass raw.)</technical_language>

Target:
protected List retrieveTransactions() { List<List<CorporateBilledCorporatePaidTransaction>> groupedTransactions = new ArrayList<List<CorporateBilledCorporatePaidTransaction>>(); List<CorporateBilledCorporatePaidTransaction> cbcpTransactions = (List<CorporateBilledCorporatePaidTransaction>) businessObjectService.findMatchingOrderBy(CorporateBilledCorporatePaidTransaction.class, new HashMap<String, String>(), KFSPropertyConstants.TRANSACTION_CREDIT_CARD_NUMBER, true); boolean singleTransaction = parameterService.getParameterValueAsBoolean(ProcurementCardCreateDocumentsStep.class, SINGLE_TRANSACTION_IND_PARM_NM); if (singleTransaction) { List<CorporateBilledCorporatePaidTransaction> documentTransactions = new ArrayList<CorporateBilledCorporatePaidTransaction>(); for (CorporateBilledCorporatePaidTransaction transaction : cbcpTransactions) { documentTransactions.add(transaction); groupedTransactions.add(documentTransactions); documentTransactions = new ArrayList<CorporateBilledCorporatePaidTransaction>(); } } else { Map<String, List<CorporateBilledCorporatePaidTransaction>> cardTransactionsMap = new HashMap<String, List<CorporateBilledCorporatePaidTransaction>>(); for (CorporateBilledCorporatePaidTransaction transaction : cbcpTransactions) { if (!cardTransactionsMap.containsKey(transaction.getTransactionCreditCardNumber())) { cardTransactionsMap.put(transaction.getTransactionCreditCardNumber(), new ArrayList<CorporateBilledCorporatePaidTransaction>()); } cardTransactionsMap.get(transaction.getTransactionCreditCardNumber()).add(transaction); } for (List<CorporateBilledCorporatePaidTransaction> cbcpTransaction : cardTransactionsMap.values()) { groupedTransactions.add(cbcpTransaction); } } return groupedTransactions; }