File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 5656 (toString [this]
5757 (str " #{" (clojure.string/join " " (map str this)) " }" ))
5858 (hashCode [this]
59- (reduce + (map #(.hashCode ^Object %) (.seq this))))
59+ (reduce + (keep #(when % ( .hashCode ^Object %) ) (.seq this))))
6060 (equals [this other]
6161 (or (identical? this other)
6262 (and (instance? Set other)
Original file line number Diff line number Diff line change 160160 (is (= (hash m1) (hash m2)))
161161 (is (= (.hashCode m1) (.hashCode m2)))
162162 (is (= (hash (ordered-set )) (hash (hash-set ))))
163- (is (= (.hashCode (ordered-set )) (.hashCode (hash-set ))))))
163+ (is (= (.hashCode (ordered-set )) (.hashCode (hash-set ))))
164+ (is (= (hash (ordered-set nil )) (hash (hash-set nil ))))
165+ (is (= (.hashCode (ordered-set nil )) (.hashCode (hash-set nil ))))
166+ (is (= (.hashCode (ordered-set nil :a {:b nil })) (.hashCode (hash-set nil :a {:b nil }))))))
164167
165168(deftest nil-hash-code-npe
166169 ; ; No assertions here; just check that it doesn't NPE
167170 ; ; See: https://github.com/amalloy/ordered/issues/27
168- (are [contents] (.hashCode (ordered-set contents))
171+ (are [contents] (.hashCode (apply ordered-set contents))
169172 [nil ]
170173 [nil :a ]))
You can’t perform that action at this time.
0 commit comments