/// <summary> /// Returns the hash code value for this list. /// <para/> /// The hash code determination takes into consideration any values in /// this collection and values of any nested collections, but does not /// take into consideration the data type. Therefore, the hash codes will /// be exactly the same for this <see cref="EquatableList{T}"/> and another /// <see cref="IList{T}"/> (including arrays) with the same values in the /// same order. /// </summary> /// <returns>the hash code value for this list</returns> public override int GetHashCode() { return(Collections.GetHashCode(this)); }
/// <summary> /// Returns a string representation of this collection (and any nested collections). /// The string representation consists of a list of the collection's elements in /// the order they are returned by its enumerator, enclosed in square brackets /// ("[]"). Adjacent elements are separated by the characters ", " (comma and space). /// </summary> /// <returns>a string representation of this collection</returns> public override string ToString() { return(Collections.ToString(this)); }
// TODO: When diverging from Java version of Lucene, can uncomment these to adhere to best practices when overriding the Equals method and implementing IEquatable<T>. ///// <summary>Overload of the == operator, it compares a ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/> ///// implementation.</summary> ///// <param name="x">The <see cref="EquatableList{T}"/> to compare ///// against <paramref name="y"/>.</param> ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare ///// against <paramref name="x"/>.</param> ///// <returns>True if the instances are equal, false otherwise.</returns> //public static bool operator ==(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y) //{ // // Call Equals. // return Equals(x, y); //} ///// <summary>Overload of the == operator, it compares a ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/> ///// implementation.</summary> ///// <param name="y">The <see cref="EquatableList{T}"/> to compare ///// against <paramref name="x"/>.</param> ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare ///// against <paramref name="y"/>.</param> ///// <returns>True if the instances are equal, false otherwise.</returns> //public static bool operator ==(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y) //{ // // Call equals. // return Equals(x, y); //} ///// <summary>Overload of the != operator, it compares a ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/> ///// implementation.</summary> ///// <param name="x">The <see cref="EquatableList{T}"/> to compare ///// against <paramref name="y"/>.</param> ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare ///// against <paramref name="x"/>.</param> ///// <returns>True if the instances are not equal, false otherwise.</returns> //public static bool operator !=(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y) //{ // // Return the negative of the equals operation. // return !(x == y); //} ///// <summary>Overload of the != operator, it compares a ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/> ///// implementation.</summary> ///// <param name="y">The <see cref="EquatableList{T}"/> to compare ///// against <paramref name="x"/>.</param> ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare ///// against <paramref name="y"/>.</param> ///// <returns>True if the instances are not equal, false otherwise.</returns> //public static bool operator !=(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y) //{ // // Return the negative of the equals operation. // return !(x == y); //} #endregion #region IEquatable<T> members /// <summary> /// Compares this sequence to another <see cref="IList{T}"/> /// implementation, returning <c>true</c> if they are equal, <c>false</c> otherwise. /// <para/> /// The comparison takes into consideration any values in this collection and values /// of any nested collections, but does not take into consideration the data type. /// Therefore, <see cref="EquatableList{T}"/> can equal any <see cref="IList{T}"/> /// with the exact same values in the same order. /// </summary> /// <param name="other">The other <see cref="IList{T}"/> implementation /// to compare against.</param> /// <returns><c>true</c> if the sequence in <paramref name="other"/> /// is the same as this one.</returns> public virtual bool Equals(IList <T> other) { return(Collections.Equals(this, other)); }