Пример #1
0
 /// <summary>
 /// Enqueues <paramref name="x"/> into hashqueue.
 /// </summary>
 public void Enqueue(T x)
 {
     x.ThrowIfArgumentNull(nameof(x));
     if (!map.TryGetValue(x, out Deque <Node <T> > nodeq))
     {
         nodeq  = new Deque <Node <T> >();
         map[x] = nodeq;
     }
     nodeq.Enqueue(dq.Enqueue(x));
 }
Пример #2
0
        public static IDeque ConcatenateIDeque(IDeque a, IDeque b)
        {
            // create new deque as a copy of a
            IDeque newDeque = (IDeque)Activator.CreateInstance(a.GetType(), a);

            // then append b
            foreach (object entry in b)
            {
                newDeque.Enqueue(entry);
            }

            return(newDeque);
        }
Пример #3
0
 /// <inheritdoc />
 public void Enqueue(T item)
 {
     _deque.Enqueue(item);
 }