public bool Equals(AbstractStack <T> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (Count != other.Count)
            {
                return(false);
            }
            using var iterator1 = GetEnumerator();
            using var iterator2 = other.GetEnumerator();
            for (int i = 0; i < Count; i++)
            {
                iterator1.MoveNext();
                iterator2.MoveNext();
                if (iterator1.Current != null && !iterator1.Current.Equals(iterator2.Current))
                {
                    return(false);
                }
            }

            return(true);
        }
        public static void Reverse <T>(this AbstractStack <T> stack)
        {
            var array = new T[stack.Count];
            var index = 0;

            foreach (var item in stack)
            {
                array[index++] = item;
            }

            stack.Clear();
            foreach (var item in array)
            {
                stack.Push(item);
            }
        }