Udostępnij za pośrednictwem


Set.CopyOf(ICollection) Method

Definition

Caution

Use 'Java.Util.ISet.CopyOf'. This class will be removed in a future release.

Returns an unmodifiable Set containing the elements of the given Collection.

[Android.Runtime.Register("copyOf", "(Ljava/util/Collection;)Ljava/util/Set;", "", ApiSince=31)]
[Java.Interop.JavaTypeParameters(new System.String[] { "E" })]
[System.Obsolete("Use 'Java.Util.ISet.CopyOf'. This class will be removed in a future release.")]
public static System.Collections.ICollection CopyOf (System.Collections.ICollection coll);
[<Android.Runtime.Register("copyOf", "(Ljava/util/Collection;)Ljava/util/Set;", "", ApiSince=31)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E" })>]
[<System.Obsolete("Use 'Java.Util.ISet.CopyOf'. This class will be removed in a future release.")>]
static member CopyOf : System.Collections.ICollection -> System.Collections.ICollection

Parameters

coll
ICollection

a Collection from which elements are drawn, must be non-null

Returns

a Set containing the elements of the given Collection

Attributes

Remarks

Returns an unmodifiable Set containing the elements of the given Collection. The given Collection must not be null, and it must not contain any null elements. If the given Collection contains duplicate elements, an arbitrary element of the duplicates is preserved. If the given Collection is subsequently modified, the returned Set will not reflect such modifications.

Added in 10.

Java documentation for java.util.Set.copyOf(java.util.Collection<? extends E>).

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