Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<Contatto> cercaPerNome(String s)
- {
- ArrayList<Contatto> temp = new ArrayList<Contatto>();
- for (int i = 0; i < rubrica.size();i++)
- {
- if (rubrica.get(i).getNome().startsWith(s)) temp.add(rubrica.get(i));
- }
- return temp;
- }
- public int aggiungi(String nome, String email, String tel)
- {
- Contatto e = new Contatto(nome,email,tel);
- for(int i = 0; i<rubrica.size();i++)
- {
- if (rubrica.get(i).getNome().equals(nome) && rubrica.get(i).geteMail().equals(email)) return -1;
- }
- if(rubrica.size() >= MAX_DIM) return -2;
- rubrica.add(e);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement