gratuityTransaction = (GratuityTransaction) it.next();
gratuityTransaction = (IGratuityTransaction) it.next();
    public double calculateValueToSubtract(IGratuitySituation gratuitySituation) {        double exemptionValue = 0;        if (gratuitySituation.getExemptionPercentage() != null) {            exemptionValue = gratuitySituation.getTotalValue().doubleValue()                    * (gratuitySituation.getExemptionPercentage().doubleValue() / 100.0);        }        if (gratuitySituation.getExemptionValue() != null) {            exemptionValue += gratuitySituation.getExemptionValue().doubleValue();        }        List transactionList = gratuitySituation.getTransactionList();        List reimbursementGuideEntries = null;        Iterator it = transactionList.iterator();        IGratuityTransaction gratuityTransaction = null;        double payedValue = 0;        double reimbursedValue = 0;        while (it.hasNext()) {            gratuityTransaction = (GratuityTransaction) it.next();            payedValue += gratuityTransaction.getValue().doubleValue();            if (gratuityTransaction.getGuideEntry() != null) {                reimbursementGuideEntries = gratuityTransaction.getGuideEntry()                        .getReimbursementGuideEntries();                if (reimbursementGuideEntries != null) {                    Iterator reimbursementIterator = reimbursementGuideEntries.iterator();                    IReimbursementGuideEntry reimbursementGuideEntry = null;                    while (reimbursementIterator.hasNext()) {                        reimbursementGuideEntry = (IReimbursementGuideEntry) reimbursementIterator                                .next();                        if (reimbursementGuideEntry.getReimbursementGuide()                                .getActiveReimbursementGuideSituation().getReimbursementGuideState()                                .equals(ReimbursementGuideState.PAYED)) {                            reimbursedValue += reimbursementGuideEntry.getValue().doubleValue();                        }                    }                }            }        }        return (exemptionValue + payedValue - reimbursedValue);    }