Aggiunto costruttore elenco

This commit is contained in:
Giacomo R. 2023-02-05 16:22:02 +01:00
parent 270bca2813
commit 324d59a222
1 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,15 @@ public class Elenco <T> {
private T[] elenco;
private int dim;
/**
*
* @param max
*/
public Elenco(int max) {
elenco = (T[]) new Object[max];
dim = 0;
}
public void add(T elemento) {
if(dim == elenco.length) {
elenco = Arrays.copyOf(elenco, dim*2);