T - The type of the elements in the array, or if that type is
primitive, the boxed version of that type (e.g., Integer
for int).public final class Array<T>
extends java.lang.Object
implements java.lang.Cloneable
Array operations
to operate on possibly-primitive arrays.
This isn't used by generated Dafny code, which directly uses values of type
Object when the element type isn't known, relying on a TypeDescriptor passed
in. It's much more pleasant to use, and more type-safe, than the bare
TypeDescriptor operations, however, so extern implementors may be interested.
It is also used to implement DafnySequence.| Modifier and Type | Method and Description |
|---|---|
Array<T> |
copy() |
void |
copy(int offset,
Array<T> to,
int toOffset,
int length) |
Array<T> |
copyOfRange(int lo,
int hi) |
TypeDescriptor<T> |
elementType() |
void |
fill(T value) |
static <T> Array<T> |
fromList(TypeDescriptor<T> eltType,
java.util.List<T> elements) |
T |
get(int index) |
int |
length() |
static <T> Array<T> |
newArray(TypeDescriptor<T> eltType,
int length) |
void |
set(int index,
T value) |
boolean |
shallowEquals(Array<T> other) |
java.lang.Object |
unwrap() |
static java.lang.Object |
unwrap(Array<?> array) |
static boolean[] |
unwrapBooleans(Array<java.lang.Boolean> array) |
static byte[] |
unwrapBytes(Array<java.lang.Byte> array) |
static char[] |
unwrapChars(Array<java.lang.Character> array) |
static int[] |
unwrapInts(Array<java.lang.Integer> array) |
static long[] |
unwrapLongs(Array<java.lang.Long> array) |
static <T> T[] |
unwrapObjects(Array<T> array) |
static short[] |
unwrapShorts(Array<java.lang.Short> array) |
static Array<java.lang.Boolean> |
wrap(boolean[] array) |
static Array<java.lang.Byte> |
wrap(byte[] array) |
static Array<java.lang.Character> |
wrap(char[] array) |
static Array<java.lang.Integer> |
wrap(int[] array) |
static Array<java.lang.Long> |
wrap(long[] array) |
static Array<java.lang.Short> |
wrap(short[] array) |
static <T> Array<T> |
wrap(TypeDescriptor<T> eltType,
java.lang.Object array) |
static <T> Array<T> |
wrap(TypeDescriptor<T> eltType,
T[] array) |
public static <T> Array<T> newArray(TypeDescriptor<T> eltType, int length)
public static <T> Array<T> fromList(TypeDescriptor<T> eltType, java.util.List<T> elements)
public TypeDescriptor<T> elementType()
public java.lang.Object unwrap()
public T get(int index)
public void set(int index,
T value)
public int length()
public void fill(T value)
public static <T> Array<T> wrap(TypeDescriptor<T> eltType, java.lang.Object array)
public static <T> Array<T> wrap(TypeDescriptor<T> eltType, T[] array)
public static Array<java.lang.Byte> wrap(byte[] array)
public static Array<java.lang.Short> wrap(short[] array)
public static Array<java.lang.Integer> wrap(int[] array)
public static Array<java.lang.Long> wrap(long[] array)
public static Array<java.lang.Boolean> wrap(boolean[] array)
public static Array<java.lang.Character> wrap(char[] array)
public static java.lang.Object unwrap(Array<?> array)
public static <T> T[] unwrapObjects(Array<T> array)
public static byte[] unwrapBytes(Array<java.lang.Byte> array)
public static short[] unwrapShorts(Array<java.lang.Short> array)
public static int[] unwrapInts(Array<java.lang.Integer> array)
public static long[] unwrapLongs(Array<java.lang.Long> array)
public static boolean[] unwrapBooleans(Array<java.lang.Boolean> array)
public static char[] unwrapChars(Array<java.lang.Character> array)