File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 56
56
(toString [this]
57
57
(str " #{" (clojure.string/join " " (map str this)) " }" ))
58
58
(hashCode [this]
59
- (reduce + (keep #(when % (.hashCode ^Object %)) (.seq this))))
59
+ (reduce + (keep #(when ( some? %) (.hashCode ^Object %)) (.seq this))))
60
60
(equals [this other]
61
61
(or (identical? this other)
62
62
(and (instance? Set other)
Original file line number Diff line number Diff line change 165
165
(is (= (.hashCode (ordered-set nil )) (.hashCode (hash-set nil ))))
166
166
(is (= (.hashCode (ordered-set nil :a {:b nil })) (.hashCode (hash-set nil :a {:b nil }))))))
167
167
168
+ (deftest nil-and-false-hashes
169
+ (is (not= (.hashCode (ordered-set nil )) (.hashCode (hash-set false ))))
170
+ (is (not= (.hashCode (ordered-set false )) (.hashCode (hash-set nil ))))
171
+ (is (= (.hashCode (ordered-set false nil )) (.hashCode (hash-set nil false )))))
172
+
168
173
(deftest nil-hash-code-npe
169
174
; ; No assertions here; just check that it doesn't NPE
170
175
; ; See: https://github.com/amalloy/ordered/issues/27
You can’t perform that action at this time.
0 commit comments