Lista + Nodo

This commit is contained in:
La Programmatrice Verde
2026-03-24 08:39:24 +01:00
parent 1e6b15528b
commit 862a32aa39
2 changed files with 32 additions and 0 deletions

21
src/linkedlist/Lista.java Normal file
View File

@@ -0,0 +1,21 @@
package linkedlist;
public class Lista {
Nodo testa;
int size;
public Lista() {
this.testa = null;
}
//getSize(): restituisce il numero dei nodi presenti nella lista (quindi valore di ritorno è di tipo int)
//addFirst(tipoInfo info): aggiunge un nodo in testa (es. tipoInfo = char, tipoInfo = int)
//addLast(tipoInfo info): aggiunge un nodo in coda (es. tipoInfo = char, tipoInfo = int)
//addElementAt(tipoInfo info, int pos): aggiunge un nodo nella posizione indicata da pos
//removeFirst(): rimuove il nodo in testa
//removeLast(): rimuove il nodo in coda
//removeElementAt(int pos): rimuove il nodo in coda
//tipoInfo getElementAt(int pos): restituisce l'info presente nel nodo in posizione n (es. tipoInfo = char, tipoInfo = int)
//String toString()
}

11
src/linkedlist/Nodo.java Normal file
View File

@@ -0,0 +1,11 @@
package linkedlist;
public class Nodo<E> {
Nodo next;
E info;
public Nodo(E info) {
this.info = info;
this.next = null;
}
}