-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added authentication service #1007
added authentication service #1007
Conversation
everything fine? |
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -15,6 +15,12 @@ public class UserService { | |||
* Return <code>null</code> if there is no suitable user | |||
*/ | |||
public User findByEmail(String email) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < users.length; i++) { | ||
if (users[i].getEmail().equals(email)) { | ||
return users[i]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do like Map userEmailToPassword, to avoid O(n)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confident that using a map can effectively optimize the code and speed up its compilation. However, I have not yet studied this in this course, so I cannot apply it. Most likely, this will be explained in the next topics, so do not consider my solution incorrect. I have removed the unnecessary lines you pointed out, as can be seen in the following commit
No description provided.