Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-291

Null-safe comparison methods for finding most recent / least recent dates.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3
    • lang.time.*
    • None
    • N/A

    Description

      /**

      • <p>
      • Null-safe date comparison.
      • Returnes the most recent date if date1 and date2 is non-null.
      • If one of the dates are null, the non-null will be returned.
      • If both are null, null will be returned.
      • </p>
      • @param date1
      • @param date2
      • @return
        */
        public static Date mostRecent( Date date1, Date date2 )

      /**

      • <p>
      • Null-safe date comparison.
      • Returnes the least recent (oldest) date if date1 and date2 is non-null.
      • If one of the dates are null, the non-null will be returned.
      • If both are null, null will be returned.
      • </p>
      • @param date1
      • @param date2
      • @return
        */
        public static Date leastRecent( Date date1, Date date2 )

      Attachments

        1. DateUtils-patch-rev468924.txt
          3 kB
          David J. M. Karlsen
        2. ObjectUtils-patch-rev470351.txt
          5 kB
          David J. M. Karlsen

        Activity

          People

            Unassigned Unassigned
            david@davidkarlsen.com David J. M. Karlsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: