I have made a class called User
with two string attributes: Login
and Password
.
I have a database (userList
, of type ArrayList<User>
) with all the existing users, and I want to know if a login is already used or not.
I tried to use lambda expressions in order to do that, but it doesn't work:
ArrayList<String> loginList = null;
userListe.forEach(x->loginList.add(x.getLogin()));
How do I solve this?