Пример #1
0
        public static ForwardList <T> operator >(ForwardList <T> left, ForwardList <T> right)
        {
            ForwardList <T> result = (ForwardList <T>)right.Clone();

            result.GetLast().Next = ((ForwardList <T>)left.Clone()).First;
            return(result);
        }
Пример #2
0
        public static ForwardList <T> operator +(ForwardList <T> left, ForwardList <T> right)
        {
            ForwardList <T> result = (ForwardList <T>)left.Clone();
            Iterator <T>    cur = result.First, rightCur = right.First;

            while (cur != null && rightCur != null)
            {
                cur.Next = new Iterator <T>(rightCur.Value, cur.Next);
                rightCur = rightCur.Next;
                cur      = cur.Next.Next;
            }

            cur = result.GetLast();
            while (rightCur != null)
            {
                cur.Next = new Iterator <T>(rightCur.Value);
                rightCur = rightCur.Next;
                cur      = cur.Next;
            }

            return(result);
        }