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)); }
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)); }
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)); }