Sdílet prostřednictvím


IList.GetHashCode Method

Definition

Returns the hash code value for this list.

[Android.Runtime.Register("hashCode", "()I", "GetGetHashCodeHandler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int GetHashCode ();
[<Android.Runtime.Register("hashCode", "()I", "GetGetHashCodeHandler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetHashCode : unit -> int

Returns

the hash code value for this list

Implements

Attributes

Remarks

Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:

{@code
                int hashCode = 1;
                for (E e : list)
                    hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
            }

This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object#hashCode.

Java documentation for java.util.List.hashCode().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to