Language

JavaObjectArray<T> Class

Definition

Provides managed element access to a fixed-length Java object array.

[Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)]
public class JavaObjectArray<T> : Java.Interop.JavaArray<T>
[<Java.Interop.JniTypeSignature("java/lang/Object", ArrayRank=1, GenerateJavaPeer=false)>]
type JavaObjectArray<'T> = class
    inherit JavaArray<'T>

Type Parameters

T

The managed type used to marshal array element values.

Inheritance
JavaObjectArray<T>
Attributes

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.

Constructors

Name Description
JavaObjectArray<T>(IEnumerable<T>)

Creates a Java object array containing the supplied sequence values.

JavaObjectArray<T>(IList<T>)

Creates a Java object array and marshals the supplied list values into it.

JavaObjectArray<T>(Int32)

Creates a Java object array whose elements initially contain null references.

JavaObjectArray<T>(JniObjectReference, JniObjectReferenceOptions)

Initializes an object-array wrapper through the runtime's peer-construction policy.

Properties

Name Description
IsReadOnly

Gets whether array element values are read-only.

(Inherited from JavaArray<T>)
Item[Int32]

Gets or sets an element through the runtime's value marshaling services.

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.

(Inherited from JavaArray<T>)
PeerReference

Gets the JNI reference currently stored in the peer control block.

(Inherited from JavaObject)

Methods

Name Description
Clear()

Sets every Java array element to null 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.

(Inherited from JavaArray<T>)
CopyTo(T[], Int32)

Copies marshaled element values 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()

Disposes temporary marshaling arrays immediately; otherwise, uses the peer disposal policy.

Equals(Object)

Tests whether another managed peer refers to the same Java object.

(Inherited from JavaObject)
GetEnumerator()

Enumerates managed values obtained from the Java array in index order.

GetHashCode()

Returns a hash code value for the object.

(Inherited from JavaObject)
IndexOf(T)

Finds the first element matching default managed equality or recursive sequence 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.

(Inherited from JavaArray<T>)
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.

(Inherited from JavaArray<T>)
ICollection.Count

Gets the array element count through the non-generic collection interface.

(Inherited from JavaArray<T>)
ICollection.IsSynchronized

Gets whether collection access is synchronized.

(Inherited from JavaArray<T>)
ICollection.SyncRoot

Gets the object supplied for external collection synchronization.

(Inherited from JavaArray<T>)
ICollection<T>.Add(T)

Always throws NotSupportedException because the Java array cannot grow.

(Inherited from JavaArray<T>)
ICollection<T>.Count

Gets the array element count through the generic collection interface.

(Inherited from JavaArray<T>)
ICollection<T>.Remove(T)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IEnumerable.GetEnumerator()

Gets the non-generic view of the typed enumerator.

(Inherited from JavaArray<T>)
IJavaPeerable.Disposed()

Marks this peer as disposed and calls Dispose with disposing set to true.

(Inherited from JavaObject)
IJavaPeerable.Finalized()

Marks this peer as disposed and calls Dispose with disposing set to false.

(Inherited from JavaObject)
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.

(Inherited from JavaArray<T>)
IList.Contains(Object)

Searches only values compatible with the managed element type.

(Inherited from JavaArray<T>)
IList.IndexOf(Object)

Searches for an object compatible with the managed element type.

(Inherited from JavaArray<T>)
IList.Insert(Int32, Object)

Always throws NotSupportedException because insertion cannot resize the Java array.

(Inherited from JavaArray<T>)
IList.IsFixedSize

Gets whether the Java array has a fixed length.

(Inherited from JavaArray<T>)
IList.Item[Int32]

Gets or sets an element through the non-generic list interface.

(Inherited from JavaArray<T>)
IList.Remove(Object)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IList.RemoveAt(Int32)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)
IList<T>.Insert(Int32, T)

Always throws NotSupportedException because insertion cannot resize the Java array.

(Inherited from JavaArray<T>)
IList<T>.RemoveAt(Int32)

Always throws NotSupportedException because removal cannot resize the Java array.

(Inherited from JavaArray<T>)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

ToInteroperableCollection<T>(ICollection<T>)
Obsolete.

Reuses an existing typed JavaCollection or creates one from the supplied collection.

ToInteroperableCollection<T>(IList<T>)
Obsolete.

Reuses an existing typed JavaList or creates one from the supplied list.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to