Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-553

TransformedMultiValuedMap.equals() fails when comparing the value with itself

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0
    • 4.1
    • Map
    • None

    Description

      TransformedMultiValuedMap.equals() does not return true when comparing a value of a Collection key with itself. Is it allowed to put Collection as a key in TransformedMultiValuedMap at all? If not, I think it should be specified in the document. Or, equals() should be fixed accordingly.

      Reproduce step

      Test.java
      public void test()
      {
        TransformedMultiValuedMap map = TransformedMultiValuedMap.transformingMap((MultiValuedMap)new MultiValuedHashMap(),TransformerUtils.stringValueTransformer(),  TransformerUtils.stringValueTransformer());
        
        MultiValuedHashMap helperMap = new MultiValuedHashMap();
        helperMap.put("KEY", "Value");
        Collection key = helperMap.keySet();
        map.put(key, "Hi");
        Collection value = map.get(key);
        assertTrue("Contract failed: value.equals(value)", value.equals(value));
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mjkim0324 M Kim
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: