Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserService {
- Set<User> users = new HashSet<>();
- {
- User user = new User();
- user.username = "adrianvdh";
- user.password = "hello123";
- users.add(user);
- }
- public User authenicate(String username, String password) {
- User foundUser = null
- for (User userInCollection : users) {
- if (userInCollection.username.equals(username) {
- foundUser = userInCollection;
- break;
- }
- }
- return foundUser;
- }
- }
Add Comment
Please, Sign In to add comment