Exemplo n.º 1
0
 public Enumerator Init(PoolingList <T> src)
 {
     _bucket = 0;
     _index  = -1;
     _src    = src;
     _ver    = _src._ver;
     return(this);
 }
Exemplo n.º 2
0
        private void Initialize(int capacity)
        {
            var size = HashHelpers.GetPrime(capacity);

            _buckets = new PoolingListVal <int>();
            for (var i = 0; i < size; i++)
            {
                _buckets.Add(-1);
            }
            _entries  = new PoolingListVal <Entry>();
            _freeList = -1;
        }
Exemplo n.º 3
0
        public PoolingDictionary <TKey, TValue> Init(int capacity = 0, IEqualityComparer <TKey> comparer = default)
        {
            if (_buckets != default)
            {
                return(this);
            }
            _refType = typeof(TKey).IsClass;
            var size = HashHelpers.GetPrime(capacity);

            _buckets = Pool <PoolingList <int> > .Get().Init();

            for (var i = 0; i < size; i++)
            {
                _buckets.Add(EndOfChain);
            }
            _entries = Pool <PoolingList <Entry> > .Get().Init();

            _freeList = EndOfChain;
            _comparer = comparer ?? EqualityComparer <TKey> .Default;
            return(this);
        }