private static T Pop(ref SlimList <T> slimList, Int32 index) { var result = slimList[index]; slimList.RemoveAt(index); return(result); }
private static Boolean TryPeek(ref SlimList <T> slimList, out T value, Int32 index) { if (slimList.Count > 0) { return(TryResult(true, out value, slimList[index])); } else { return(TryResult(false, out value, default(T))); } }
private T Dequeue(ref SlimList <T> a, ref SlimList <T> b) { if (a.Count > 0) { return(PopLast(ref a)); } if (b.Count > 0) { return(PopFirst(ref b)); } throw new EmptySlimDequeException(); }
private static Boolean TryPeekLast(ref SlimList <T> x, out T value) => TryPeek(ref x, out value, x.Count - 1);
private static Boolean TryPeekFirst(ref SlimList <T> x, out T value) => TryPeek(ref x, out value, 0);
private static T PopLast(ref SlimList <T> x) => Pop(ref x, x.Count - 1);
private static T PopFirst(ref SlimList <T> x) => Pop(ref x, 0);