Guest User

Untitled

a guest
Dec 7th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class UserService {
  2.  
  3. Set<User> users = new HashSet<>();
  4.  
  5. {
  6. User user = new User();
  7. user.username = "adrianvdh";
  8. user.password = "hello123";
  9. users.add(user);
  10. }
  11.  
  12. public User authenicate(String username, String password) {
  13. User foundUser = null
  14. for (User userInCollection : users) {
  15. if (userInCollection.username.equals(username) {
  16. foundUser = userInCollection;
  17. break;
  18. }
  19. }
  20.  
  21. return foundUser;
  22. }
  23. }
Add Comment
Please, Sign In to add comment