Esempio n. 1
0
        /// <summary>
        /// Returns a pair of sequences, the first contains the first <paramref name="index"/> of
        /// the sequence and the second one contains the rest of them.
        /// </summary>
        /// <param name="index">The index at which the sequence will be split.</param>
        /// <remarks>if <code>index &lt;= 0 || index &gt;= Count</code>, the corresponding part
        /// of the result will be empty.</remarks>
        public Tuple <RandomAccessSequence <T>, RandomAccessSequence <T> > SplitAt(int index)
        {
            if (index <= 0)
            {
                return(Pair.New(Empty, this));
            }
            if (index >= Count)
            {
                return(Pair.New(this, Empty));
            }
            var ftSplit = _ft.SplitAt(index);

            return(Pair.New(
                       new RandomAccessSequence <T>(ftSplit.Item1),
                       new RandomAccessSequence <T>(ftSplit.Item2)));
        }