// create a new instance atomically, broken out to aid inlining private static HolidayCalendarId create(string name) { if (!name.Contains("+")) { return(CACHE.computeIfAbsent(name, n => new HolidayCalendarId(name))); } // parse + separated names once and build resolver function to aid performance // name BBB+CCC+AAA changed to sorted form of AAA+BBB+CCC // dedicated resolver function created //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: IList <HolidayCalendarId> ids = Splitter.on('+').splitToList(name).Where(n => !n.Equals(HolidayCalendarIds.NO_HOLIDAYS.Name)).Select(n => HolidayCalendarId.of(n)).Distinct().OrderBy(comparing(HolidayCalendarId::getName)).ToList(); string normalizedName = Joiner.on('+').join(ids); System.Func <HolidayCalendarId, ReferenceData, HolidayCalendar> resolver = (id, refData) => { HolidayCalendar cal = refData.queryValueOrNull(id); if (cal != null) { return(cal); } cal = HolidayCalendars.NO_HOLIDAYS; foreach (HolidayCalendarId splitId in ids) { HolidayCalendar splitCal = refData.queryValueOrNull(splitId); if (splitCal == null) { throw new ReferenceDataNotFoundException(Messages.format("Reference data not found for '{}' of type 'HolidayCalendarId' when finding '{}'", splitId, id)); } cal = cal.combinedWith(splitCal); } return(cal); }; // cache under the normalized and non-normalized names HolidayCalendarId id = CACHE.computeIfAbsent(normalizedName, n => new HolidayCalendarId(normalizedName, resolver)); CACHE.GetOrAdd(name, id); return(id); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private static com.opengamma.strata.collect.result.Result<?> noEvaluatorResult(java.util.List<String> remaining, Object value) private static Result <object> noEvaluatorResult(IList <string> remaining, object value) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: return(Result.failure(FailureReason.INVALID, "Expression '{}' cannot be invoked on type {}", Joiner.on('.').join(remaining), value.GetType().FullName)); }
public override string ToString() { return("FxMatrix[" + Joiner.on(", ").join(Currencies) + " : " + Stream.of(rates.toArrayUnsafe()).map(Arrays.toString).collect(Collectors.joining(",")) + "]"); }