public class OdinArray extends AbstractContainer implements java.lang.Iterable<OdinElement>
size
Constructor and Description |
---|
OdinArray() |
Modifier and Type | Method and Description |
---|---|
<T> OdinObject<T> |
add(T value)
Create and add a
OdinObject with the given value to this array |
void |
addAll(java.util.Collection<?> objects) |
OdinArray |
addArray()
Add a new
OdinArray to this array |
<T extends OdinElement> |
addElement(T element)
Add a
OdinElement to this array. |
<T extends OdinElement> |
addElementTo(int index,
T element)
Add a
OdinElement to the specified position. |
OdinNode |
addNode()
Add a new
OdinNode to this array |
<T> OdinObject<T> |
addTo(int index,
T value)
Add a new
OdinObject with the given value to the specified position. |
void |
clear() |
<V> V |
compute(java.util.function.Function<OdinArray,V> function)
Run a function with this array as parameter.
|
<T> boolean |
contains(T value) |
OdinElement |
get(int index)
Get the
OdinElement present at the given index. |
<T> T |
getValue(int index)
Get the object value present at the given index.
|
<T> int |
indexOf(T value)
Get the position in this array of the
OdinObject containing the given value. |
boolean |
isArray() |
java.util.Iterator<OdinElement> |
iterator() |
<T> OdinObject<T> |
remove(T value)
Remove the
OdinObject containing the given value. |
void |
removeAll(java.util.Collection<?> values) |
OdinElement |
removeFrom(int index)
Remove the
OdinElement present at the given index. |
OdinArray |
run(java.util.function.Consumer<OdinArray> consumer)
Run a consumer with this array as parameter.
|
<T> OdinObject<T> |
set(int index,
T value)
Replace the element present at specified position by a new
OdinObject with the given value.If index is out of bounds, this method call add(Object) . |
<T extends OdinElement> |
set(int index,
T element)
Replace the element present at specified position by the given element.
If index is out of bounds, this method call addElement(OdinElement) . |
java.lang.String |
toString() |
buildContentExtra, find, findValue, getContentExtra, hasContentExtra, isEmpty, setContentExtra, size
asArray, asNode, asObject, buildExtra, getExtra, hasExtra, isNode, isObject, setExtra
public OdinArray addArray()
OdinArray
to this arraypublic <T> OdinObject<T> add(T value)
OdinObject
with the given value to this arrayT
- object value typevalue
- object valuepublic <T extends OdinElement> T addElement(T element)
OdinElement
to this array.T
- element typeelement
- element to addpublic <T> OdinObject<T> addTo(int index, T value)
OdinObject
with the given value to the specified position.T
- object value typeindex
- object position in this arrayvalue
- object valuepublic <T extends OdinElement> T addElementTo(int index, T element)
OdinElement
to the specified position.T
- element typeindex
- element position in this arrayelement
- element to addpublic void addAll(java.util.Collection<?> objects)
public <T> OdinObject<T> set(int index, T value)
OdinObject
with the given value.add(Object)
.T
- object value typeindex
- object position in this arrayvalue
- new object valuepublic <T extends OdinElement> T set(int index, T element)
addElement(OdinElement)
.T
- element typeindex
- element position in this arrayelement
- element to addpublic <T> boolean contains(T value)
public <T> int indexOf(T value)
OdinObject
containing the given value.T
- value typevalue
- element valuepublic OdinElement get(int index)
AbstractContainer
OdinElement
present at the given index.get
in class AbstractContainer
index
- element positionpublic <T> T getValue(int index)
AbstractContainer
getValue
in class AbstractContainer
T
- the type of the returned objectindex
- element positionpublic void clear()
clear
in class AbstractContainer
public <T> OdinObject<T> remove(T value)
OdinObject
containing the given value.T
- value typevalue
- element valuepublic void removeAll(java.util.Collection<?> values)
public OdinElement removeFrom(int index)
AbstractContainer
OdinElement
present at the given index.removeFrom
in class AbstractContainer
index
- element positionpublic OdinArray run(java.util.function.Consumer<OdinArray> consumer)
consumer
- consumer to usepublic <V> V compute(java.util.function.Function<OdinArray,V> function)
V
- the type of the returned valuefunction
- consumer to usepublic boolean isArray()
isArray
in class OdinElement
public java.util.Iterator<OdinElement> iterator()
iterator
in interface java.lang.Iterable<OdinElement>
public java.lang.String toString()
toString
in class java.lang.Object