void TestBetterQueue() { UKQueue<int> q = new UKQueue<int>(); for (int i = 0; i < 20; ++i) q.Enqueue(i); Debug.Log(q.Count); Debug.Log(q.Peek()); Debug.Log(q.Count); Debug.Log(q.Peek()); Debug.Log(q.Count); Debug.Log(q.Dequeue()); Debug.Log(q.Count); int x = 20; Debug.Log("LOOP"); while (q.Count > 0) { q.Enqueue(x); ++x; if (q.Count > 0) Debug.Log(q.Dequeue()); if (q.Count > 0) Debug.Log(q.Dequeue()); } Debug.Log("DONE"); try { Debug.Log(q.Dequeue()); } catch (System.InvalidOperationException) { // should throw an exception } }
private UKQueue<GameObject> GetQueueByGroup(string recycleGroup) { if (!cachedObjects.ContainsKey (recycleGroup)) { cachedObjects [recycleGroup] = new UKQueue<GameObject> (); } return cachedObjects[recycleGroup]; }