Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void convertPrimitiveSetToJavaSet()
        internal virtual void ConvertPrimitiveSetToJavaSet()
        {
            LongSet     longSet = newSetWith(1L, 3L, 5L);
            ISet <long> longs   = PrimitiveLongCollections.ToSet(longSet);

            assertThat(longs, containsInAnyOrder(1L, 3L, 5L));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDeduplicateWithRandomArrays()
        internal virtual void ShouldDeduplicateWithRandomArrays()
        {
            int arrayLength = 5000;
            int iterations  = 10;

            for (int i = 0; i < iterations; i++)
            {
                long[]           array         = ThreadLocalRandom.current().longs(arrayLength, 0, arrayLength).sorted().toArray();
                long[]           dedupedActual = PrimitiveLongCollections.Deduplicate(array);
                SortedSet <long> set           = new SortedSet <long>();
                foreach (long value in array)
                {
                    set.Add(value);
                }
                long[]             dedupedExpected = new long[set.Count];
                IEnumerator <long> itr             = set.GetEnumerator();
                for (int j = 0; j < dedupedExpected.Length; j++)
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    assertTrue(itr.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    dedupedExpected[j] = itr.next();
                }
                assertArrayEquals(dedupedExpected, dedupedActual);
            }
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void filter()
        internal virtual void Filter()
        {
            // GIVEN
            LongIterator items = PrimitiveLongCollections.Iterator(1, 2, 3);

            // WHEN
            LongIterator filtered = PrimitiveLongCollections.Filter(items, item => item != 2);

            // THEN
            AssertItems(filtered, 1, 3);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void arrayOfItemsAsIterator()
        internal virtual void ArrayOfItemsAsIterator()
        {
            // GIVEN
            long[] items = new long[] { 2, 5, 234 };

            // WHEN
            LongIterator iterator = PrimitiveLongCollections.Iterator(items);

            // THEN
            AssertItems(iterator, items);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDeduplicate()
        internal virtual void ShouldDeduplicate()
        {
            // GIVEN
            long[] array = new long[] { 1L, 1L, 2L, 5L, 6L, 6L };

            // WHEN
            long[] deduped = PrimitiveLongCollections.Deduplicate(array);

            // THEN
            assertArrayEquals(new long[] { 1L, 2L, 5L, 6L }, deduped);
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void asArray()
        internal virtual void AsArray()
        {
            // GIVEN
            LongIterator items = PrimitiveLongCollections.Iterator(1, 2, 3);

            // WHEN
            long[] array = PrimitiveLongCollections.AsArray(items);

            // THEN
            assertTrue(Arrays.Equals(new long[] { 1, 2, 3 }, array));
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void count()
        internal virtual void Count()
        {
            // GIVEN
            LongIterator items = PrimitiveLongCollections.Iterator(1, 2, 3);

            // WHEN
            int count = PrimitiveLongCollections.Count(items);

            // THEN
            assertEquals(3, count);
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void indexOf()
        internal virtual void IndexOf()
        {
            // GIVEN
            System.Func <LongIterator> items = () => PrimitiveLongCollections.Iterator(10, 20, 30);

            // THEN
            assertEquals(-1, PrimitiveLongCollections.IndexOf(items(), 55));
            assertEquals(0, PrimitiveLongCollections.IndexOf(items(), 10));
            assertEquals(1, PrimitiveLongCollections.IndexOf(items(), 20));
            assertEquals(2, PrimitiveLongCollections.IndexOf(items(), 30));
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void convertJavaCollectionToSetOfPrimitives()
        internal virtual void ConvertJavaCollectionToSetOfPrimitives()
        {
            IList <long> longs = new IList <long> {
                1L, 4L, 7L
            };
            LongSet longSet = PrimitiveLongCollections.AsSet(longs);

            assertTrue(longSet.contains(1L));
            assertTrue(longSet.contains(4L));
            assertTrue(longSet.contains(7L));
            assertEquals(3, longSet.size());
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public static PrimitiveLongResourceIterator iterator(org.neo4j.graphdb.Resource resource, final long... items)
        public static PrimitiveLongResourceIterator Iterator(Resource resource, params long[] items)
        {
            return(resourceIterator(PrimitiveLongCollections.Iterator(items), resource));
        }