All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.namekdev.entity_tracker.utils.Array Maven / Gradle / Ivy

The newest version!
package net.namekdev.entity_tracker.utils;

import java.util.ArrayList;

public class Array {
	protected final ArrayList _array;


	public Array() {
		_array = new ArrayList();
	}

	public Array(int capacity) {
		_array = new ArrayList(capacity);
	}

	public T get(int index) {
		return _array.get(index);
	}

	public void set(int index, T value) {
		ensureSize(index+1);
		_array.set(index, value);
	}

	public void ensureSize(int size) {
		_array.ensureCapacity(size);

		int i = _array.size();
		while (i++ < size) {
			_array.add(null);
		}
	}

	public void clear() {
		_array.clear();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy