JavaArray<T> Class
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.
Provides indexed access to a fixed-length Java array.
[Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)]
public abstract class JavaArray<T> : Java.Interop.JavaObject, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.IList
[<Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)>]
type JavaArray<'T> = class
inherit JavaObject
interface IList
interface ICollection
interface IEnumerable
interface IList<'T>
interface ICollection<'T>
interface seq<'T>
Type Parameters
- T
The managed type used for each array element.
- Inheritance
- Derived
- Attributes
- Implements
Remarks
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.
Properties
| Name | Description |
|---|---|
| IsReadOnly |
Gets whether array element values are read-only. |
| Item[Int32] |
Gets or sets an array element through the derived implementation. |
| JniIdentityHashCode |
Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). (Inherited from JavaObject) |
| JniManagedPeerState |
Gets the state flags last assigned by the runtime. (Inherited from JavaObject) |
| JniPeerMembers |
Gets the member-access information for this managed Java peer. (Inherited from JavaObject) |
| Length |
Gets the number of elements in the Java array. |
| PeerReference |
Gets the JNI reference currently stored in the peer control block. (Inherited from JavaObject) |
Methods
| Name | Description |
|---|---|
| Clear() |
Clears element values without changing the array length. |
| Construct(JniObjectReference, JniObjectReferenceOptions) |
Delegates construction of this peer to the runtime's value manager. (Inherited from JavaObject) |
| Contains(T) |
Tests whether the typed index search finds an element. |
| CopyTo(T[], Int32) |
Copies all Java array elements into an existing managed array. |
| Dispose() |
Delegates peer disposal to the runtime's value manager. (Inherited from JavaObject) |
| Dispose(Boolean) |
Provides a derived-class cleanup hook; the base implementation does nothing. (Inherited from JavaObject) |
| DisposeUnlessReferenced() |
Asks the value manager to dispose this peer unless its mapping retains this same managed instance. (Inherited from JavaObject) |
| Equals(Object) |
Tests whether another managed peer refers to the same Java object. (Inherited from JavaObject) |
| GetEnumerator() |
Enumerates the array elements in index order. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from JavaObject) |
| IndexOf(T) |
Finds the first matching element using the array implementation's comparison. |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) |
Stores a reference value in the control block without creating a JNI reference copy. (Inherited from JavaObject) |
| ToArray() |
Copies all elements into a new managed array. |
| ToString() |
Returns a string representation of the object. (Inherited from JavaObject) |
| UnregisterFromRuntime() |
Removes this managed peer from the runtime mapping without disposing its JNI reference. (Inherited from JavaObject) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copies the Java array elements into an existing managed array. |
| ICollection.Count |
Gets the array element count through the non-generic collection interface. |
| ICollection.IsSynchronized |
Gets whether collection access is synchronized. |
| ICollection.SyncRoot |
Gets the object supplied for external collection synchronization. |
| ICollection<T>.Add(T) |
Always throws NotSupportedException because the Java array cannot grow. |
| ICollection<T>.Count |
Gets the array element count through the generic collection interface. |
| ICollection<T>.Remove(T) |
Always throws NotSupportedException because removal cannot resize the Java array. |
| IEnumerable.GetEnumerator() |
Gets the non-generic view of the typed enumerator. |
| IJavaPeerable.Disposed() |
Marks this peer as disposed and calls |
| IJavaPeerable.Finalized() |
Marks this peer as disposed and calls |
| IJavaPeerable.JniObjectReferenceControlBlock |
Gets the native control-block pointer used by this peer. (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
Stores the identity hash code supplied by the runtime. (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
Replaces the stored managed peer state flags. (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
Updates the peer reference and releases a disposed peer's control block when the reference is invalid. (Inherited from JavaObject) |
| IList.Add(Object) |
Always throws NotSupportedException because the Java array cannot grow. |
| IList.Contains(Object) |
Searches only values compatible with the managed element type. |
| IList.IndexOf(Object) |
Searches for an object compatible with the managed element type. |
| IList.Insert(Int32, Object) |
Always throws NotSupportedException because insertion cannot resize the Java array. |
| IList.IsFixedSize |
Gets whether the Java array has a fixed length. |
| IList.Item[Int32] |
Gets or sets an element through the non-generic list interface. |
| IList.Remove(Object) |
Always throws NotSupportedException because removal cannot resize the Java array. |
| IList.RemoveAt(Int32) |
Always throws NotSupportedException because removal cannot resize the Java array. |
| IList<T>.Insert(Int32, T) |
Always throws NotSupportedException because insertion cannot resize the Java array. |
| IList<T>.RemoveAt(Int32) |
Always throws NotSupportedException because removal cannot resize the Java array. |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| ToInteroperableCollection<T>(ICollection<T>) |
Obsolete.
Reuses an existing typed |
| ToInteroperableCollection<T>(IList<T>) |
Obsolete.
Reuses an existing typed |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |