Module JavaReferenceArray

module JavaReferenceArray: sig .. end
Support for pack.Class[] and prim[]...[] types.

type 'a t = 'a java_reference_array
The type of arrays.
 

Usual operations

 
val length : 'a java_reference_array -> java_int
length a returns the length of a.
Raises Java_exception if a is null
 
val get : 'a java_reference_array -> java_int -> 'a
get a i returns the element at index i in a.
Raises Java_exception if a is null, or i is out of bounds
 
val set : 'a java_reference_array -> java_int -> 'a -> unit
set a i x changes the element at index i in a to x.
Raises Java_exception if a is null, or i is out of bounds
 
val blit : 'a java_reference_array ->
java_int -> 'a java_reference_array -> java_int -> java_int -> unit
blit src srcofs dst dstofs len copies len elements from src at offset srcofs to dst at offset dstofs.
Raises Java_exception if either src or ofs is null
 
val iter : ('a -> unit) -> 'a java_reference_array -> unit
iter f a applies f to each element of a.
Raises Java_exception if a is null
 
val iteri : (java_int -> 'a -> unit) -> 'a java_reference_array -> unit
iter f a applies f to each element of a (also passing element index).
Raises Java_exception if a is null
 
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b java_reference_array -> 'a
fold_left f z a returns f (... (f (f z a_0) a_1)) where a_i is the element of a at index i.
Raises Java_exception if a is null
 
val fold_right : ('a -> 'b -> 'b) -> 'a java_reference_array -> 'b -> 'b
fold_right f a z returns f a_0 (f a_1 (f ... z)) where a_i is the element of a at index i.
Raises Java_exception if a is null
 

Java operations

 
val to_object : 'a java_reference_array -> java'lang'Object java_instance
to_object a casts a to a bare object.
 
val of_object : java'lang'Object java_instance -> 'a java_reference_array
of_object o casts object o to array.
Raises Java_exception if cast fails
 
val equals : 'a t -> 'a t -> bool
equals a1 a2 tests whether a1 and a2 are equal; see equals(...).
 
val hash_code : 'a t -> java_int
hash_code a returns the hash code of a; see hashCode(...).
 
val to_string : 'a t -> JavaString.t
to_string a returns the string representation of a; see toString(...).
 
val null : 'a java_reference_array
The null value.
 
val is_null : 'a java_reference_array -> bool
is_null x returns true iff x is equal to null.
 
val is_not_null : 'a java_reference_array -> bool
is_not_null x returns false iff x is equal to null.
 
val wrap : 'a java_reference_array -> 'a java_reference_array option
wrap x wraps the array x into an option type:
  • Some x if x is not null;
  • None if x is null.

 
val unwrap : 'a java_reference_array option -> 'a java_reference_array
unwrap x unwraps the option x into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.