示例#1
0
文件: Kolejka.cs 项目: Szary66/PIII
        public T  Pop()
        {
            if (_head == null)
            {
                return(default(T));
            }

            var returnValue = _head.value;

            _head = _head.next;

            return(returnValue);
        }
示例#2
0
文件: Kolejka.cs 项目: Szary66/PIII
        IEnumerator <T> GetEnumerator()
        {
            var tail = _tail;

            if (tail != null)
            {
                do
                {
                    yield return(tail.value);

                    _tail = tail.next;
                }while(tail != null);
            }
        }
示例#3
0
文件: Kolejka.cs 项目: Szary66/PIII
        public void Push(T element)
        {
            KolejkaNode <T> node = new KolejkaNode <T> ();

            node.value = element;
            node.next  = null;

            if (_head != null)
            {
                _tail.next = node;
            }
            else
            {
                _head = node;
            }

            _tail.next = node;
            _tail      = node;
        }