Пример #1
0
        /// <summary>
        ///     Removes the last item from the list.
        /// </summary>
        /// <returns> </returns>
        /// <exception cref="InvalidOperationException">Thrown if the list is empty.</exception>
        public ImmList <T> RemoveLast()
        {
            this.CheckNotEmpty();
            var ret = Root.RemoveLast(Lineage.Immutable).Wrap();

#if ASSERTS
            if (ret.Root.Measure > 0)
            {
                ret.Last.AssertEqual(this[-2]);
            }
            ret.Root.Measure.AssertEqual(Root.Measure - 1);
#endif
            return(ret);
        }