*Non so citare*
Si sono agli inizi di Swing... con precisione posso dirti che quello che ho fatto è il frutto della prima lezione introduttiva dell'argomento xD
Applicazione.java
codice:
package applicazione;
import java.util.HashMap;
public class Applicazione {
private HashMap<Utente, String> utenti = new HashMap<Utente, String>();
public boolean nuovoUtente (Utente u) {
if(!utenti.containsKey(u)) {
utenti.put(u, u.getEmailUtente());
return true;
}
return false;
}
public boolean cercaUtente (Utente u) {
if(utenti.containsKey(u))
return true;
else
return false;
}
public boolean password (Utente u) {
for(Utente key : utenti.keySet())
if(utenti.get(u) == utenti.get(key) &&
utenti.get(u.getPasswordUtente()).equals(utenti.get(key.getPasswordUtente())) )
return true;
return false;
}
}
Utente.java
codice:
package applicazione;
import java.util.HashMap;
public class Applicazione {
private HashMap<Utente, String> utenti = new HashMap<Utente, String>();
public boolean nuovoUtente (Utente u) {
if(!utenti.containsKey(u)) {
utenti.put(u, u.getEmailUtente());
return true;
}
return false;
}
public boolean cercaUtente (Utente u) {
if(utenti.containsKey(u))
return true;
else
return false;
}
public boolean password (Utente u) {
for(Utente key : utenti.keySet())
if(utenti.get(u) == utenti.get(key) &&
utenti.get(u.getPasswordUtente()).equals(utenti.get(key.getPasswordUtente())) )
return true;
return false;
}
}