Collections.Singleton(Object) Method

Definition

Returns an immutable set containing only the specified object.

[Android.Runtime.Register("singleton", "(Ljava/lang/Object;)Ljava/util/Set;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static System.Collections.ICollection Singleton (Java.Lang.Object? o);
[<Android.Runtime.Register("singleton", "(Ljava/lang/Object;)Ljava/util/Set;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Singleton : Java.Lang.Object -> System.Collections.ICollection

Parameters

o
Object

the sole object to be stored in the returned set.

Returns

an immutable set containing only the specified object.

Attributes

Remarks

Returns an immutable set containing only the specified object. The returned set is serializable.

Java documentation for java.util.Collections.singleton(T).

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