Partager via


HashSet.NewHashSet(Int32) Method

Definition

Creates a new, empty HashSet suitable for the expected number of elements.

[Android.Runtime.Register("newHashSet", "(I)Ljava/util/HashSet;", "", ApiSince=35)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Util.HashSet NewHashSet (int numElements);
[<Android.Runtime.Register("newHashSet", "(I)Ljava/util/HashSet;", "", ApiSince=35)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member NewHashSet : int -> Java.Util.HashSet

Parameters

numElements
Int32

the expected number of elements

Returns

the newly created set

Attributes

Remarks

Creates a new, empty HashSet suitable for the expected number of elements. The returned set uses the default load factor of 0.75, and its initial capacity is generally large enough so that the expected number of elements can be added without resizing the set.

Added in 19.

Java documentation for java.util.HashSet.newHashSet(int).

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