Пример #1
0
 public E Next()
 {
     parent.FullyLock();
     try
     {
         if (current == null)
         {
             throw new NoSuchElementException();
         }
         E x = currentElement;
         lastRet        = current;
         current        = NextNode(current);
         currentElement = (current == null) ? null : current.item;
         return(x);
     }
     finally
     {
         parent.FullyUnlock();
     }
 }
Пример #2
0
            public LBQIterator(LinkedBlockingQueue <E> parent)
            {
                this.parent = parent;

                parent.FullyLock();
                try {
                    current = parent.head.next;
                    if (current != null)
                    {
                        currentElement = current.item;
                    }
                }
                finally
                {
                    parent.FullyUnlock();
                }
            }