Class ArrayModule<T>
java.lang.Object
com.github.collinalpert.java2db.modules.ArrayModule<T>
- Type Parameters:
T- The type of the array.
public class ArrayModule<T>
extends java.lang.Object
A helper module to work with arrays and especially adding elements to them.
- Author:
- Collin Alpert
-
Constructor Summary
Constructors Constructor Description ArrayModule(java.lang.Class<T> clazz, int chunkSize) -
Method Summary
Modifier and Type Method Description voidaddElement(T element)Adds an element to the array.T[]getArray()Gets an array with all the elements that were added to it.
-
Constructor Details
-
Method Details
-
getArray
Gets an array with all the elements that were added to it. Should there be excess slots from when the array was extended to fit more elements, they will be trimmed away.- Returns:
- An array containing the added elements.
-
addElement
Adds an element to the array. When the max size of the array is reached, it is extended by the specifiedchunkSizein the constructor.- Parameters:
element- The element to add to the array.
-