Lista + Nodo
This commit is contained in:
21
src/linkedlist/Lista.java
Normal file
21
src/linkedlist/Lista.java
Normal 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
11
src/linkedlist/Nodo.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user