Skip to content
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

Chore: redundant operation on java.time object #1454

Merged

Conversation

dbmalkovsky
Copy link
Collaborator

If you look at the implementation of `LocalDataTime.from()' you will find:

  public static LocalDateTime from(TemporalAccessor temporal) {
        if (temporal instanceof LocalDateTime) {
            return (LocalDateTime) temporal;
        } else if (temporal instanceof ZonedDateTime) {

So the existing line:

LocalDateTime firstPay = LocalDateTime.from(today);

would take the first if-branch and just return the parameter passed in.

So there is no need to call the method as today is a LocalDateTime object.

@dbmalkovsky dbmalkovsky requested a review from mwithi November 19, 2024 20:54
Copy link
Member

@mwithi mwithi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks a lot!

@mwithi mwithi merged commit f808f5a into informatici:develop Nov 19, 2024
1 check passed
@dbmalkovsky dbmalkovsky deleted the dbmRedundantOperationOnJavaTime branch November 19, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants