private double computeIndexFactor(CdsIndexIsdaCreditCurveNode node, MarketData marketData) { double numDefaulted = node.getLegalEntityIds().stream() .map(s -> marketData.getValue(LegalEntityInformationId.of(s))) .map(casting(LegalEntityInformation.class)) .filter(LegalEntityInformation::isDefaulted) .collect(Collectors.toList()) .size(); double numTotal = node.getLegalEntityIds().size(); return (numTotal - numDefaulted) / numTotal; }