Example #1
0
        /// <summary>
        ///     Removes the first item from the list.
        /// </summary>
        /// <returns> </returns>
        /// <exception cref="InvalidOperationException">Thrown if the list is empty.</exception>
        public ImmList <T> RemoveFirst()
        {
            this.CheckNotEmpty();
            if (Root.IsEmpty)
            {
                throw Errors.Is_empty;
            }
            var ret = Root.RemoveFirst(Lineage.Immutable).Wrap();

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