Ejemplo n.º 1
0
        public E Get(uint index)
        {
            E current = headSentinel.element;

            if (!(index > size || index < 0))
            {
                E              temp  = headSentinel.element;
                uint           i     = 0;
                CustomIterator ite   = Iterator();
                bool           found = false;

                while (ite.HasNext() && !found)
                {
                    current = ite.Next();
                    if (i == index)
                    {
                        temp  = current;
                        found = true;
                    }
                    i++;
                }
            }
            else
            {
                Console.WriteLine("Bad index given to MyLinkedList.Get()");
            }

            return(current);
        }
Ejemplo n.º 2
0
 public void NextWeapon()
 {
     _weaponIterator.Next();
     _currentWeapon = _weaponIterator.Current();
 }