I want to check when I register new user if an username is already in use, so I have a class with a Vector<Users>, where I save all my users whit their parameters. But when I use my function usernameExist(String nuovo) that compare only the first username in the list with the string I have inserted. I have also implemented Serializable interface so I can load my list of users every time , but it work properly. If I use an Iterator to read all list I have no problem, but every function that uses for-each loop doesn't work. 
 //Constructor
 public UsersList()
 {
     list = new Vector<User>();
 }
 //The method i use to check if the username exist
 public boolean usernameExist(String nuovo)
 {
    for(User user : lista)
    {
        return user.matchUsername(nuovo);
    }
    return false;
 }
 //In the class User
 //Constructor of User
 public User(String nome, String cognome, String email, String  username, String password)
 {
    //Variable initialization
 }
 public boolean matchUsername(String inserted)
 {
    return username.equalsIgnoreCase(inserted);
 }
It's making me crazy :D, thank you for the help!
 
     
     
    