Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-750

Compare should not have special case for Number

    XMLWordPrintableJSON

Details

    Description

      The current implementation of Compare has a special case for Number which uses doubleValue for all comparisons. However, this fails for some implementations of Number, e.g. BigInteger. Also, most implementations of Number implement Comparable for appropriately typed arguments. It should be more robust and less surprising to simply use Object.equals and Comparable.compareTo. This would also be more performant as it removes the instanceof checks.

      If we want the option of treating all numbers as doubles, perhaps something called CompareDouble would be more appropriate.

      Attachments

        Activity

          People

            mhfrantz Matt Frantz
            mhfrantz Matt Frantz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: