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

Modify Tuple equals to take BigDecimal comparison

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Not A Problem
    • 3.12.0
    • None
    • lang.tuple.*
    • None

    Description

      I understand that this would be a bit controversial. Imhp as possibly ignorable suggestion, it'd be more helpful if the Tuple supports BgDecimal numeric equality rather than simply checking object.

       

      In a particular case, you may want to check if a collection of pairs contain a certain pair which includes BigDecimal values. Then to check object equality is maybe just right or not. But in many cases, I assume that numeric comparison would be more demanded such as following simple example. 

      Set<Pair<String, BigDecimal>> someCollection = getPairs(); 
      someCollection.contains(Pair.of("foo", BigDecimal.valueOf(100))); 
      

       

      I created the PR. Please take a look. I'm happy to whichever it is accepted or not receiving feedback.

      https://github.com/apache/commons-lang/pull/780

      Attachments

        Activity

          People

            Unassigned Unassigned
            Chikao Chikashi Toyoshima
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m