//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void getIfAbsentPutWith()
        internal virtual void getIfAbsentPutWith()
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings({"Convert2Lambda", "Anonymous2MethodRef"}) final org.eclipse.collections.api.block.function.primitive.LongFunction<String> function = spy(new org.eclipse.collections.api.block.function.primitive.LongFunction<String>()
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            LongFunction <string> function = spy(new LongFunctionAnonymousInnerClass(this));

            assertEquals(10, _map.getIfAbsentPutWith(0, function, "10"));
            assertEquals(10, _map.getIfAbsentPutWith(0, function, "10"));
            assertEquals(11, _map.getIfAbsentPutWith(1, function, "11"));
            assertEquals(11, _map.getIfAbsentPutWith(1, function, "11"));
            assertEquals(12, _map.getIfAbsentPutWith(2, function, "12"));
            assertEquals(12, _map.getIfAbsentPutWith(2, function, "12"));

            verify(function).longValueOf(eq("10"));
            verify(function).longValueOf(eq("11"));
            verify(function).longValueOf(eq("12"));
            verifyNoMoreInteractions(function);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: public <P> long getIfAbsentPutWith(long key, org.eclipse.collections.api.block.function.primitive.LongFunction<? super P> function, P parameter)
        public override long GetIfAbsentPutWith <P, T1>(long key, LongFunction <T1> function, P parameter)
        {
            return(getIfAbsentPut(key, () => function.longValueOf(parameter)));
        }