Example #1
0
        /// <summary>
        /// Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.
        /// <summary>
        /// <param name="from">the index of the first element (inclusive).</param>
        /// <param name="to">the index of the last element (inclusive).</param>
        /// <returns>a new list</returns>
        /// <exception cref="IndexOutOfRangeException">index is out of range (<i>_size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=_size())</i>). </exception>
        public virtual AbstractFloatList PartFromTo(int from, int to)
        {
            CheckRangeFromTo(from, to, _size);

            int Length = to - from + 1;
            var part   = new FloatArrayList(Length);

            part.AddAllOfFromTo(this, from, to);
            return(part);
        }
Example #2
0
        /// <summary>
        /// Returns a list which is a concatenation of <code>times</code> times the receiver.
        /// <summary>
        /// <param name="times">the number of times the receiver shall be copied.</param>
        public virtual AbstractFloatList Times(int times)
        {
            AbstractFloatList newList = new FloatArrayList(times * Size);

            for (int i = times; --i >= 0;)
            {
                newList.AddAllOfFromTo(this, 0, Size - 1);
            }
            return(newList);
        }