Exemple #1
0
            internal virtual ImmutableLongList GenerateCollisions(int n)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long seed = rnd.nextLong();
                long seed = outerInstance.rnd.NextLong();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.list.primitive.MutableLongList elements;
                MutableLongList elements;

                using (MutableLinearProbeLongHashSet s = new MutableLinearProbeLongHashSet(outerInstance.memoryAllocator))
                {
                    long v = s.HashAndMask(seed);
                    while (s.HashAndMask(v) != 0 || v == 0 || v == 1)
                    {
                        ++v;
                    }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int h = s.hashAndMask(v);
                    int h = s.HashAndMask(v);
                    elements = LongLists.mutable.with(v);

                    while (elements.size() < n)
                    {
                        ++v;
                        if (s.HashAndMask(v) == h)
                        {
                            elements.add(v);
                        }
                    }
                }
                return(elements.toImmutable());
            }