//-------------------------------------------------------------------------
        public virtual void test_zipWithIndex()
        {
            Stream <string> @base             = Stream.of("a", "b", "c");
            IList <ObjIntPair <string> > test = Guavate.zipWithIndex(@base).collect(Collectors.toList());

            assertEquals(test, ImmutableList.of(ObjIntPair.of("a", 0), ObjIntPair.of("b", 1), ObjIntPair.of("c", 2)));
        }
        public virtual void test_zipWithIndex_empty()
        {
            Stream <string> @base             = Stream.of();
            IList <ObjIntPair <string> > test = Guavate.zipWithIndex(@base).collect(Collectors.toList());

            assertEquals(test, ImmutableList.of());
        }
        public virtual void test_poll_exception()
        {
            AtomicInteger counter = new AtomicInteger();

            System.Func <string> pollingFn = () =>
            {
                switch (counter.incrementAndGet())
                {
                case 1:
                    return(null);

                case 2:
                    throw new System.InvalidOperationException("Expected");

                default:
                    throw new AssertionError("Test failed");
                }
            };

            ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

            try
            {
                CompletableFuture <string> future = Guavate.poll(executor, Duration.ofMillis(100), Duration.ofMillis(100), pollingFn);
                assertThrows(() => future.join(), typeof(CompletionException), "java.lang.IllegalStateException: Expected");
            }
            finally
            {
                executor.shutdown();
            }
        }
        public virtual void test_toCombinedFuture()
        {
            CompletableFuture <string> future1 = new CompletableFuture <string>();

            future1.complete("A");
            System.Threading.CountdownEvent latch   = new System.Threading.CountdownEvent(1);
            CompletableFuture <string>      future2 = CompletableFuture.supplyAsync(() =>
            {
                try
                {
                    latch.await();
                }
                catch (InterruptedException)
                {
                }
                return("B");
            });
            IList <CompletableFuture <string> > input = ImmutableList.of(future1, future2);

//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            CompletableFuture <IList <string> > test = input.collect(Guavate.toCombinedFuture());

            assertEquals(test.Done, false);
            latch.Signal();
            IList <string> combined = test.join();

            assertEquals(test.Done, true);
            assertEquals(combined.Count, 2);
            assertEquals(combined[0], "A");
            assertEquals(combined[1], "B");
        }
Example #5
0
        /// <summary>
        /// Returns a collector that can be used to create a multi-currency amount
        /// from a stream of amounts where each amount has a different currency.
        /// <para>
        /// Each amount in the stream must have a different currency.
        ///
        /// </para>
        /// </summary>
        /// <returns> the collector </returns>
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: private static java.util.stream.Collector<CurrencyAmount, ?, MultiCurrencyAmount> collectorInternal()
        private static Collector <CurrencyAmount, ?, MultiCurrencyAmount> collectorInternal()
        {
            // this method must not be exposed publicly as misuse creates an instance with invalid state
            // it exists because when used internally it offers better performance than collector()
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            return(Collectors.collectingAndThen(Guavate.toImmutableSortedSet(), MultiCurrencyAmount::new));
        }
        //-------------------------------------------------------------------------
        public virtual void test_entry()
        {
            KeyValuePair <string, int> test = Guavate.entry("A", 1);

            assertEquals(test.Key, "A");
            assertEquals(test.Value, (int?)1);
        }
        //-------------------------------------------------------------------------
        public virtual void test_stream_Iterable()
        {
            IEnumerable <string> iterable = Arrays.asList("a", "b", "c");
            IList <string>       test     = Guavate.stream(iterable).collect(Collectors.toList());

            assertEquals(test, ImmutableList.of("a", "b", "c"));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_toImmutableSortedMap_keyValue_duplicateKeys()
        public virtual void test_toImmutableSortedMap_keyValue_duplicateKeys()
        {
            IList <string> list = Arrays.asList("a", "ab", "c", "bb", "b", "a");

//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            list.collect(Guavate.toImmutableSortedMap(s => s.length(), s => "!" + s));
        }
        public virtual void test_combineFuturesAsMap_exception()
        {
            CompletableFuture <string> future1 = new CompletableFuture <string>();

            future1.complete("A");
            System.Threading.CountdownEvent latch   = new System.Threading.CountdownEvent(1);
            CompletableFuture <string>      future2 = CompletableFuture.supplyAsync(() =>
            {
                try
                {
                    latch.await();
                }
                catch (InterruptedException)
                {
                }
                throw new System.InvalidOperationException("Oops");
            });
            IDictionary <string, CompletableFuture <string> > input = ImmutableMap.of("a", future1, "b", future2);

            CompletableFuture <IDictionary <string, string> > test = Guavate.combineFuturesAsMap(input);

            assertEquals(test.Done, false);
            latch.Signal();
            assertThrows(typeof(CompletionException), () => test.join());
            assertEquals(test.Done, true);
            assertEquals(test.CompletedExceptionally, true);
        }
        //-------------------------------------------------------------------------
        public virtual void test_poll()
        {
            AtomicInteger counter = new AtomicInteger();

            System.Func <string> pollingFn = () =>
            {
                switch (counter.incrementAndGet())
                {
                case 1:
                    return(null);

                case 2:
                    return("Yes");

                default:
                    throw new AssertionError("Test failed");
                }
            };

            ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

            CompletableFuture <string> future = Guavate.poll(executor, Duration.ofMillis(100), Duration.ofMillis(100), pollingFn);

            assertEquals(future.join(), "Yes");
        }
        //-------------------------------------------------------------------------
        public virtual void test_combineFuturesAsMap()
        {
            CompletableFuture <string> future1 = new CompletableFuture <string>();

            future1.complete("A");
            System.Threading.CountdownEvent latch   = new System.Threading.CountdownEvent(1);
            CompletableFuture <string>      future2 = CompletableFuture.supplyAsync(() =>
            {
                try
                {
                    latch.await();
                }
                catch (InterruptedException)
                {
                }
                return("B");
            });
            IDictionary <string, CompletableFuture <string> > input = ImmutableMap.of("a", future1, "b", future2);

            CompletableFuture <IDictionary <string, string> > test = Guavate.combineFuturesAsMap(input);

            assertEquals(test.Done, false);
            latch.Signal();
            IDictionary <string, string> combined = test.join();

            assertEquals(test.Done, true);
            assertEquals(combined.Count, 2);
            assertEquals(combined["a"], "A");
            assertEquals(combined["b"], "B");
        }
        //-------------------------------------------------------------------------
        public virtual void test_not_Predicate()
        {
            IList <string> data = Arrays.asList("a", "", "c");
            IList <string> test = data.Where(Guavate.not(string.isEmpty)).ToList();

            assertEquals(test, ImmutableList.of("a", "c"));
        }
        public virtual void test_splittingBySize()
        {
            IList <string> list = Arrays.asList("a", "ab", "b", "bb", "c", "a");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableList <ImmutableList <string> > test = list.collect(Guavate.splittingBySize(4));

            assertEquals(test, ImmutableList.of(ImmutableList.of("a", "ab", "b", "bb"), ImmutableList.of("c", "a")));
        }
        public virtual void test_toImmutableSortedMap_keyValue()
        {
            IList <string> list = Arrays.asList("bob", "a", "ab");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableSortedMap <int, string> test = list.collect(Guavate.toImmutableSortedMap(s => s.length(), s => "!" + s));

            assertEquals(test, ImmutableSortedMap.naturalOrder().put(1, "!a").put(2, "!ab").put(3, "!bob").build());
        }
        public virtual void test_toImmutableSet()
        {
            IList <string> list = Arrays.asList("a", "ab", "b", "bb", "c", "a");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableSet <string> test = list.Where(s => s.length() == 1).collect(Guavate.toImmutableSet());

            assertEquals(test, ImmutableSet.of("a", "b", "c"));
        }
        public virtual void test_zip_empty()
        {
            Stream <string>             base1 = Stream.of();
            Stream <int>                base2 = Stream.of();
            IList <Pair <string, int> > test  = Guavate.zip(base1, base2).collect(Collectors.toList());

            assertEquals(test, ImmutableList.of());
        }
        public virtual void test_zip_secondLonger()
        {
            Stream <string>             base1 = Stream.of("a", "b");
            Stream <int>                base2 = Stream.of(1, 2, 3);
            IList <Pair <string, int> > test  = Guavate.zip(base1, base2).collect(Collectors.toList());

            assertEquals(test, ImmutableList.of(Pair.of("a", 1), Pair.of("b", 2)));
        }
Example #18
0
        /// <summary>
        /// Creates a resource from a fully qualified resource name.
        /// <para>
        /// If the resource name does not start with a slash '/', one will be prepended.
        /// Use <seealso cref="#ofClasspath(Class, String)"/> to get a relative resource.
        /// </para>
        /// <para>
        /// In Java 9 and later, resources can be encapsulated due to the module system.
        /// As such, this method is caller sensitive.
        /// It finds the class of the method that called this one, and uses that to search for
        /// resources using <seealso cref="Class#getResource(String)"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="resourceName">  the resource name, which will have a slash '/' prepended if missing </param>
        /// <returns> the resource locator </returns>
        public static ResourceLocator ofClasspath(string resourceName)
        {
            ArgChecker.notNull(resourceName, "classpathLocator");
            string searchName = resourceName.StartsWith("/", StringComparison.Ordinal) ? resourceName : "/" + resourceName;
            Type   caller     = Guavate.callerClass(3);

            return(ofClasspath(caller, searchName));
        }
        //-------------------------------------------------------------------------
        public virtual void test_concatToList()
        {
            IEnumerable <string> iterable1 = Arrays.asList("a", "b", "c");
            IEnumerable <string> iterable2 = Arrays.asList("d", "e", "f");
            IList <string>       test      = Guavate.concatToList(iterable1, iterable2);

            assertEquals(test, ImmutableList.of("a", "b", "c", "d", "e", "f"));
        }
        public virtual void test_concatToList_differentTypes()
        {
            IEnumerable <int>      iterable1 = Arrays.asList(1, 2, 3);
            IEnumerable <double>   iterable2 = Arrays.asList(10d, 20d, 30d);
            ImmutableList <Number> test      = Guavate.concatToList(iterable1, iterable2);

            assertEquals(test, ImmutableList.of(1, 2, 3, 10d, 20d, 30d));
        }
        public virtual void test_toImmutableSetMultimap_keyValue()
        {
            IList <string> list = Arrays.asList("a", "ab", "b", "bb", "c", "a");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableSetMultimap <int, string>    test     = list.collect(Guavate.toImmutableSetMultimap(s => s.length(), s => "!" + s));
            ImmutableSetMultimap <object, object> expected = ImmutableSetMultimap.builder().put(1, "!a").put(2, "!ab").put(1, "!b").put(2, "!bb").put(1, "!c").build();

            assertEquals(test, expected);
        }
        public virtual void test_stream_Optional()
        {
            Optional <string> optional = "foo";
            IList <string>    test1    = Guavate.stream(optional).collect(Collectors.toList());

            assertEquals(test1, ImmutableList.of("foo"));

            Optional <string> empty = null;
            IList <string>    test2 = Guavate.stream(empty).collect(Collectors.toList());

            assertEquals(test2, ImmutableList.of());
        }
        public virtual void test_toImmutableMap_mergeFn()
        {
            IList <string> list = Arrays.asList("b", "a", "b", "b", "c", "a");
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IDictionary <string, int> result   = list.collect(Guavate.toImmutableMap(s => s, s => 1, (s1, s2) => s1 + s2));
            IDictionary <string, int> expected = ImmutableMap.of("a", 2, "b", 3, "c", 1);

            assertEquals(result, expected);
            IEnumerator <string> iterator = result.Keys.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(iterator.next(), "b");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(iterator.next(), "a");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(iterator.next(), "c");
        }
 // finds value from CSV
 private static Optional <string> findValueWithFallback(CsvRow row, string leg, string field)
 {
     return(Guavate.firstNonEmpty(row.findValue(leg + field), row.findValue(field)));
 }
Example #25
0
 /// <summary>
 /// Returns a multi currency amount array representing the total of the input arrays.
 /// <para>
 /// If the input contains the same currency more than once, the amounts are added together.
 ///
 /// </para>
 /// </summary>
 /// <param name="arrays">  the amount arrays </param>
 /// <returns> the total amounts </returns>
 public static MultiCurrencyAmountArray total(IEnumerable <CurrencyAmountArray> arrays)
 {
     return(Guavate.stream(arrays).collect(toMultiCurrencyAmountArray()));
 }
Example #26
0
        public virtual void test_loadAllDates()
        {
            LocalDate sampleDate = ALL_DATES[3];     // 2017-04-21
            ImmutableList <LocalDate> expDates  = ImmutableList.of(LocalDate.of(2017, 0x7, 21), LocalDate.of(2017, 10, 0x7), LocalDate.of(2018, 4, 13), LocalDate.of(2019, 4, 12), LocalDate.of(2020, 3, 20), LocalDate.of(2021, 3, 19), LocalDate.of(2022, 3, 19), LocalDate.of(2023, 3, 17), LocalDate.of(2024, 6, 17), LocalDate.of(2025, 3, 18), LocalDate.of(2026, 3, 20), LocalDate.of(2027, 3, 20), LocalDate.of(2031, 12, 19), LocalDate.of(2037, 3, 17), LocalDate.of(2047, 3, 17), LocalDate.of(2056, 3, 17));
            ImmutableList <string>    expTenors = ImmutableList.of("3M", "6M", "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "15Y", "20Y", "30Y", "40Y");
            RepoGroup   repoGroup      = RepoGroup.of("JP-REPO");
            DoubleArray expRepoXValues = DoubleArray.of(3, n => ACT_365F.relativeYearFraction(sampleDate, expDates.get(n)));
            DoubleArray expRepoYValues = DoubleArray.of(-0.0019521, -0.0016021, -0.0022521);
            ImmutableList <LabelDateParameterMetadata> expRepoMetadata = IntStream.range(0, 3).mapToObj(n => LabelDateParameterMetadata.of(expDates.get(n), expTenors.get(n))).collect(Guavate.toImmutableList());
            LegalEntityGroup legalEntityGroup = LegalEntityGroup.of("JP-GOVT");
            DoubleArray      expIssuerXValues = DoubleArray.of(expDates.size(), n => ACT_365F.relativeYearFraction(sampleDate, expDates.get(n)));
            DoubleArray      expIssuerYValues = DoubleArray.of(-0.0019511690511744527, -0.001497422302092893, -0.0021798583657932176, -0.002215700360912938, -0.0021722324679574866, -0.001922059591219172, -0.0015461646763548528, -0.0014835851245462084, -0.001118669580570464, -5.476767138782941E-4, -2.2155596172855965E-4, 2.0333291172821893E-5, 0.00284500423293463, 0.005876533417933958, 0.007957581583531789, 0.009134630405512047);
            ImmutableList <LabelDateParameterMetadata> expIssuerMetadata = IntStream.range(0, expDates.size()).mapToObj(n => LabelDateParameterMetadata.of(expDates.get(n), expTenors.get(n))).collect(Guavate.toImmutableList());

            ImmutableListMultimap <LocalDate, LegalEntityCurveGroup> allCurves = LegalEntityRatesCurvesCsvLoader.loadAllDates(ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));

//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'containsAll' method:
            assertTrue(allCurves.Keys.containsAll(ALL_DATES));
            ImmutableList <LegalEntityCurveGroup> groups = allCurves.get(sampleDate);

            assertEquals(groups.size(), 2);
            // group 0
            LegalEntityCurveGroup group0 = groups.get(0);

            assertEquals(group0.Name, CurveGroupName.of("Default1"));
            // repo
            assertEquals(group0.RepoCurves.size(), 1);
            Curve repoCurve = group0.RepoCurves.get(Pair.of(repoGroup, JPY));
            InterpolatedNodalCurve expectedRepoCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-REPO-1"), ACT_365F, expRepoMetadata), expRepoXValues, expRepoYValues, CurveInterpolators.LINEAR, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);

            assertEquals(repoCurve, expectedRepoCurve);
            // issuer
            assertEquals(group0.IssuerCurves.size(), 2);
            Curve issuerCurve = group0.IssuerCurves.get(Pair.of(legalEntityGroup, JPY));
            InterpolatedNodalCurve expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-GOVT-1"), ACT_365F, expIssuerMetadata), expIssuerXValues, expIssuerYValues, CurveInterpolators.LINEAR, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);

            assertEquals(issuerCurve, expectedIssuerCurve);
            Curve usIssuerCurve = group0.IssuerCurves.get(Pair.of(LegalEntityGroup.of("US-GOVT"), USD));

            expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("US-GOVT"), ACT_360, expIssuerMetadata), DoubleArray.of(expDates.size(), n => ACT_360.relativeYearFraction(sampleDate, expDates.get(n))), expIssuerYValues, CurveInterpolators.NATURAL_SPLINE, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);
            assertEquals(usIssuerCurve, expectedIssuerCurve);
            // group 1
            LegalEntityCurveGroup group1 = groups.get(1);

            assertEquals(group1.Name, CurveGroupName.of("Default2"));
            // repo
            repoCurve         = group1.RepoCurves.get(Pair.of(repoGroup, JPY));
            expectedRepoCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-REPO-2"), ACT_365F, expRepoMetadata), expRepoXValues, expRepoYValues, CurveInterpolators.DOUBLE_QUADRATIC, CurveExtrapolators.LINEAR, CurveExtrapolators.LINEAR);
            assertEquals(repoCurve, expectedRepoCurve);
            // issuer
            assertEquals(group1.IssuerCurves.size(), 1);
            issuerCurve         = group1.IssuerCurves.get(Pair.of(legalEntityGroup, JPY));
            expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-GOVT-2"), ACT_365F, expIssuerMetadata), expIssuerXValues, expIssuerYValues, CurveInterpolators.DOUBLE_QUADRATIC, CurveExtrapolators.LINEAR, CurveExtrapolators.LINEAR);
            assertEquals(issuerCurve, expectedIssuerCurve);
        }
        private static IDictionary <object, int> buildNodeMap(IList <object> nodeIdentifiers)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            return(Guavate.zipWithIndex(nodeIdentifiers.stream()).collect(toImmutableMap(ObjIntPair::getFirst, ObjIntPair::getSecond)));
        }
Example #28
0
        /// <summary>
        /// Computes bucketed CS01 for CDS index using a single credit curve.
        /// <para>
        /// This is coherent to the pricer <seealso cref="IsdaHomogenousCdsIndexTradePricer"/>.
        /// The relevant credit curve must be stored in {@code RatesProvider}.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the trade </param>
        /// <param name="bucketCdsIndex">  the CDS index bucket </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="refData">  the reference data </param>
        /// <returns> the bucketed CS01 </returns>
        public virtual CurrencyParameterSensitivity bucketedCs01(ResolvedCdsIndexTrade trade, IList <ResolvedCdsIndexTrade> bucketCdsIndex, CreditRatesProvider ratesProvider, ReferenceData refData)
        {
            ResolvedCdsTrade cdsTrade = trade.toSingleNameCds();
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IList <ResolvedCdsTrade> bucketCds = bucketCdsIndex.Select(ResolvedCdsIndexTrade::toSingleNameCds).ToList();
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IList <ResolvedTradeParameterMetadata> metadata     = bucketCdsIndex.Select(t => ResolvedTradeParameterMetadata.of(t, t.Product.ProtectionEndDate.ToString())).collect(Guavate.toImmutableList());
            CurrencyParameterSensitivity           bucketedCs01 = this.bucketedCs01(cdsTrade, bucketCds, metadata, ratesProvider, refData);
            double indexFactor = getIndexFactor(cdsTrade.Product, ratesProvider);

            return(bucketedCs01.multipliedBy(indexFactor));
        }
Example #29
0
        /// <summary>
        /// Computes bucketed CS01 for CDS.
        /// <para>
        /// The relevant credit curve must be stored in {@code RatesProvider}.
        ///
        /// </para>
        /// </summary>
        /// <param name="trade">  the trade </param>
        /// <param name="bucketCds">  the CDS bucket </param>
        /// <param name="ratesProvider">  the rates provider </param>
        /// <param name="refData">  the reference data </param>
        /// <returns> the bucketed CS01 </returns>
        public virtual CurrencyParameterSensitivity bucketedCs01(ResolvedCdsTrade trade, IList <ResolvedCdsTrade> bucketCds, CreditRatesProvider ratesProvider, ReferenceData refData)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IList <ResolvedTradeParameterMetadata> metadata = bucketCds.Select(t => ResolvedTradeParameterMetadata.of(t, t.Product.ProtectionEndDate.ToString())).collect(Guavate.toImmutableList());

            return(bucketedCs01(trade, bucketCds, metadata, ratesProvider, refData));
        }
        /// <summary>
        /// Applies an operation to the sensitivities in this instance.
        /// <para>
        /// The result will consist of the same entries, but with the operator applied to each sensitivity value.
        /// This instance is immutable and unaffected by this method.
        /// </para>
        /// <para>
        /// This is used to apply a mathematical operation to the sensitivity values.
        /// For example, the operator could multiply the sensitivities by a constant, or take the inverse.
        /// <pre>
        ///   inverse = base.mapSensitivities(value -> 1 / value);
        /// </pre>
        ///
        /// </para>
        /// </summary>
        /// <param name="operator">  the operator to be applied to the sensitivities </param>
        /// <returns> a {@code PointSensitivities} based on this one, with the operator applied to the sensitivity values </returns>
        public PointSensitivities mapSensitivities(System.Func <double, double> @operator)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            return(sensitivities.Select(s => s.withSensitivity(@operator(s.Sensitivity))).collect(Collectors.collectingAndThen(Guavate.toImmutableList(), PointSensitivities::new)));
        }