Ejemplo n.º 1
0
        public bool SequenceEqual(RepeatEnumerable <int> second, IEqualityComparer <int> comparer)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            if (this.InnerCount == 0 && second.InnerCount == 0)
            {
                return(true);
            }

            if (this.InnerCount > 1 || second.InnerCount > 1)
            {
                return(false);
            }

            // must be exactly one now item
            comparer = comparer ?? EqualityComparer <int> .Default;

            // only equal sequences if their single element is equal
            return(comparer.Equals(this.Start, second.Item));
        }
Ejemplo n.º 2
0
        public bool SequenceEqual(RepeatEnumerable <TItem> second, IEqualityComparer <TItem> comparer)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(second.InnerCount == 0);
        }
        public bool SequenceEqual(RepeatEnumerable <TItem> second)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            if (second.InnerCount != 1)
            {
                return(false);
            }

            return(EqualityComparer <TItem> .Default.Equals(default(TItem), second.Item));
        }
Ejemplo n.º 4
0
        public bool SequenceEqual(RepeatEnumerable <TItem> second, IEqualityComparer <TItem> comparer)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            if (InnerCount != second.InnerCount)
            {
                return(false);
            }

            comparer = comparer ?? EqualityComparer <TItem> .Default;

            return(comparer.Equals(Item, second.Item));
        }
Ejemplo n.º 5
0
 public bool SequenceEqual(RepeatEnumerable <TItem> second) => SequenceEqual(second, null);
Ejemplo n.º 6
0
 public static System.Collections.Generic.LinkedList <TItem> LinkedList <TItem>(RepeatEnumerable <TItem> second)
 => LinkedListImpl <TItem, RepeatEnumerable <TItem>, RepeatEnumerator <TItem> >(ref second);
Ejemplo n.º 7
0
 public static System.Collections.Generic.Stack <TItem> Stack <TItem>(RepeatEnumerable <TItem> second)
 => StackImpl <TItem, RepeatEnumerable <TItem>, RepeatEnumerator <TItem> >(ref second);
Ejemplo n.º 8
0
 public static System.Collections.Generic.Queue <TItem> Queue <TItem>(RepeatEnumerable <TItem> second)
 => QueueImpl <TItem, RepeatEnumerable <TItem>, RepeatEnumerator <TItem> >(ref second);