K - the typepublic final class ImmutableArray<K>
extends java.lang.Object
implements java.lang.Iterable<K>
| Modifier and Type | Method and Description |
|---|---|
K[] |
array()
Get the data.
|
static <K> ImmutableArray<K> |
create(K... array)
Create an immutable array.
|
static <K> ImmutableArray<K> |
empty()
Get an empty immutable array.
|
K |
get(int index)
Get the entry at this index.
|
ImmutableArray<K> |
insert(int index,
K obj)
Insert an entry at this index.
|
java.util.Iterator<K> |
iterator()
Get an iterator over all entries.
|
int |
length()
Get the length.
|
ImmutableArray<K> |
remove(int index)
Remove the entry at this index.
|
ImmutableArray<K> |
set(int index,
K obj)
Set the entry at this index.
|
ImmutableArray<K> |
subArray(int fromIndex,
int toIndex)
Get a sub-array.
|
java.lang.String |
toString() |
public K get(int index)
index - the indexpublic int length()
public ImmutableArray<K> set(int index, K obj)
index - the indexobj - the objectpublic ImmutableArray<K> insert(int index, K obj)
index - the indexobj - the objectpublic ImmutableArray<K> remove(int index)
index - the indexpublic ImmutableArray<K> subArray(int fromIndex, int toIndex)
fromIndex - the index of the first entrytoIndex - the end index, plus one@SafeVarargs public static <K> ImmutableArray<K> create(K... array)
array - the datapublic K[] array()
public java.lang.String toString()
toString in class java.lang.Objectpublic static <K> ImmutableArray<K> empty()
K - the key type