File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
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 + (keep #(when % (.hashCode ^Object %)) (.seq this))))
59+ (reduce + (keep #(when ( some? %) (.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 165165 (is (= (.hashCode (ordered-set nil )) (.hashCode (hash-set nil ))))
166166 (is (= (.hashCode (ordered-set nil :a {:b nil })) (.hashCode (hash-set nil :a {:b nil }))))))
167167
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+
168173(deftest nil-hash-code-npe
169174 ; ; No assertions here; just check that it doesn't NPE
170175 ; ; See: https://github.com/amalloy/ordered/issues/27
You can’t perform that action at this time.
0 commit comments