Package org.ujorm.tools.common
Class Array<T>
java.lang.Object
org.ujorm.tools.common.Array<T>
- All Implemented Interfaces:
Serializable
Methods to manage object arrays.
Usage
Arrayarray = Array.of('A', 'B', 'C', 'D', 'E'); array.getFirst().orElse(undef); array.getLast().orElse(undef); array.getItem(9).orElse(undef); array.getItem(-2).orElse(undef); array.removeFirst(); array.join('P', 'C')
- Author:
- Pavel Ponec
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd new items to the new ArrayAdd new items to the new Arrayclone()booleanget(int i) Negative index value is supported, the index out of the range returns thenullvalue.getFirst()getItem(int i) Negative index is supportedgetLast()inthashCode()booleanisEmpty()static <T> @NotNull Array<T>of(@NotNull T... chars) Factory methodintsize()stream()subArray(int from) @NotNull T[]toArray()toList()@NotNull StringtoString()
-
Field Details
-
array
-
-
Constructor Details
-
Array
-
-
Method Details
-
clone
-
toArray
-
toList
-
stream
-
get
Negative index value is supported, the index out of the range returns thenullvalue. -
getItem
Negative index is supported -
getFirst
-
getLast
-
removeFirst
-
subArray
- Parameters:
from- Negative value is supported
-
add
Add new items to the new Array -
add
Add new items to the new Array -
isEmpty
public boolean isEmpty() -
size
public int size() -
hashCode
public int hashCode() -
equals
-
toString
-
of
Factory method
-