Difference between two maps

前端 未结 7 1551
悲&欢浪女
悲&欢浪女 2021-01-01 17:22

I need to very efficiently compare two maps in Clojure/Java, and return the difference as determined by Java\'s .equals(..), with nil/null equivalent to \"not present\".

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-01 17:54

    1. Clojure maps will be fine because reading clojure maps is very fast.

    2. I can't answer you but I can give you something to look at. Brenton Ashworth made a testtool where he solved the problem with map compares. Maybe you can look at his code to get hint for implementation. http://formpluslogic.blogspot.com/2010/07/better-clojure-test-results-with-deview.html and http://github.com/brentonashworth/deview

    3. I don't think there is a better implementation that compare the keys and look up if the are different.

提交回复
热议问题