// loads a single CSV file, filtering by date private static void parseSingle(System.Predicate <LocalDate> datePredicate, CharSource resource, IDictionary <LocalDate, ImmutableMap.Builder <FxRateId, FxRate> > mutableMap) { try { CsvFile csv = CsvFile.of(resource, true); foreach (CsvRow row in csv.rows()) { string dateText = row.getField(DATE_FIELD); LocalDate date = LoaderUtils.parseDate(dateText); if (datePredicate(date)) { string currencyPairStr = row.getField(CURRENCY_PAIR_FIELD); string valueStr = row.getField(VALUE_FIELD); CurrencyPair currencyPair = CurrencyPair.parse(currencyPairStr); double value = Convert.ToDouble(valueStr); ImmutableMap.Builder <FxRateId, FxRate> builderForDate = mutableMap.computeIfAbsent(date, k => ImmutableMap.builder()); builderForDate.put(FxRateId.of(currencyPair), FxRate.of(currencyPair, value)); } } } catch (Exception ex) { throw new System.ArgumentException(Messages.format("Error processing resource as CSV file: {}", resource), ex); } }