Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285519

Change usages of TimeUnit.convert to TimeUnit.toXXX

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • None
    • core-libs
    • None
    • b03

    Description

      If target TimeUnit is known at compile time, we can use TimeUnit.toSomething method instead of TimeUnit.convert.
      E.g.

          TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS);

      Could be replaced with

          TimeUnit.NANOSECONDS.toMillis(adjust);

      It's shorter and a bit faster.

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: