Collections.UnmodifiableCollection(ICollection) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an unmodifiable view of the specified collection.
[Android.Runtime.Register("unmodifiableCollection", "(Ljava/util/Collection;)Ljava/util/Collection;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static System.Collections.ICollection UnmodifiableCollection (System.Collections.ICollection c);
[<Android.Runtime.Register("unmodifiableCollection", "(Ljava/util/Collection;)Ljava/util/Collection;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member UnmodifiableCollection : System.Collections.ICollection -> System.Collections.ICollection
Parameters
the collection for which an unmodifiable view is to be returned.
Returns
an unmodifiable view of the specified collection.
- Attributes
Remarks
Returns an unmodifiable view of the specified collection. Query operations on the returned collection "read through" to the specified collection, and attempts to modify the returned collection, whether direct or via its iterator, result in an UnsupportedOperationException
.
The returned collection does not pass the hashCode and equals operations through to the backing collection, but relies on Object
's equals
and hashCode
methods. This is necessary to preserve the contracts of these operations in the case that the backing collection is a set or a list.
The returned collection will be serializable if the specified collection is serializable.
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.