jtentor icon

DemoQueue4 - SpecialQueue.cs

jtentor | PRO | 05/18/20 12:52:58 PM UTC | 0 ⭐ | 1194 👁️ | Never ⏰ | []
C# |

720 B

|

None

|

0 👍

/

0 👎

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DemoQueue4
{
    class SpecialQueue<ELEMENT> : System.Collections.Generic.Queue<ELEMENT>
    {
        public SpecialQueue<ELEMENT> join(Queue<ELEMENT> other)
        {
            SpecialQueue<ELEMENT> result = new SpecialQueue<ELEMENT>();
 
            ELEMENT[] data = this.ToArray();
            foreach (ELEMENT e in data)
            {
                result.Enqueue(e);
            }
 
            data = other.ToArray();
            foreach (ELEMENT e in data)
            {
                result.Enqueue(e);
            }
 
            return result;
        }
    }
}

Comments