Example #1
0
        public void InsertRange(int index, FastList <T> fastList)
        {
            if (index > _count)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            int targetCount = _count + fastList.Count;

            if (_arr.Length < targetCount)
            {
                T[] newArr = new T[targetCount + 3];

                if (index > 0)
                {
                    ArrayUtils.Copy(_arr, newArr, index);
                }

                if (index < _count)
                {
                    ArrayUtils.Copy(_arr, index, newArr, index + fastList.Count, _count - index);
                }

                _arr = newArr;
            }
            else
            {
                if (index < _count)
                {
                    ArrayUtils.Copy(_arr, index, _arr, index + fastList.Count, _count - index);
                }
            }

            fastList.CopyTo(_arr, index);

            _count = targetCount;
        }
Example #2
0
 public FastList(int capability, FastList <T> fastList)
 {
     Initialize(Math.Max(capability, fastList.Count), fastList.Count);
     fastList.CopyTo(_arr, 0);
 }
Example #3
0
 public FastList(FastList <T> fastList)
 {
     Initialize(fastList.Count, fastList.Count);
     fastList.CopyTo(_arr, 0);
 }