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

Date compareTo(Date anotherDate) clarification

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      ADDITIONAL SYSTEM INFORMATION :
      JAVA 8

      A DESCRIPTION OF THE PROBLEM :
      Please find the below snippet on Date documentation
      /*
      public int compareTo(Date anotherDate)

      Compares two Dates for ordering.

      Specified by:
          compareTo in interface Comparable<Date>
      Parameters:
          anotherDate - the Date to be compared.
      Returns:
          the value 0 if the argument Date is equal to this Date; a value less than 0 if this Date is before the Date argument; and a value greater than 0 if this Date is after the Date argument.
      Throws:
          NullPointerException - if anotherDate is null.
      Since:
          1.2
      */
       In this below statement, it always return zero
      /*
      the value 0 if the argument Date is equal to this Date; a value less than 0 if this Date is before the Date argument; and a value greater than 0 if this Date is after the Date argument.
      */
      Can you please correct this?


        Attachments

          Activity

            People

            • Assignee:
              tongwan Andrew Wang
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: