public interface ProxyArray extends ProxyIterable
Proxy
Modifier and Type | Method and Description |
---|---|
static ProxyArray |
fromArray(Object... values)
Creates a proxy array backed by a Java Object array.
|
static ProxyArray |
fromList(List<Object> values)
Creates a proxy array backed by a Java List.
|
Object |
get(long index)
Returns the element at the given index.
|
default Object |
getIterator()
Returns an iterator.
|
long |
getSize()
Returns the reported size of the array.
|
default boolean |
remove(long index)
Removes the element at the given index.
|
void |
set(long index,
Value value)
Sets the element at the given index.
|
from
Object get(long index)
ArrayIndexOutOfBoundsException
- if the index is out of boundsUnsupportedOperationException
- if the operation is not supportedvoid set(long index, Value value)
ArrayIndexOutOfBoundsException
- if the index is out of boundsUnsupportedOperationException
- if the operation is not supporteddefault boolean remove(long index)
true
when the element was removed, false
when the element
didn't exist.ArrayIndexOutOfBoundsException
- if the index is out of boundsUnsupportedOperationException
- if the operation is not supportedlong getSize()
default Object getIterator()
Context.asValue(Object)
otherwise an IllegalStateException
is
thrown. Examples for valid return values are:
ProxyIterator
Iterator
, requires host iterable
access
getIterator
in interface ProxyIterable
ProxyIterator
static ProxyArray fromArray(Object... values)
unboxed
.
Note this function expects a variable number of arguments of type Object, thus might not work
as expected on non-Object array types. For instance, an int array will be stored as the first
element of the resulting proxy array. To flatten it out, convert it to an Object array first
(e.g. with Arrays.stream( myIntArray ).boxed().toArray();
).values
- the Object[] array or the vararg arguments to be proxied.static ProxyArray fromList(List<Object> values)
unboxed
.