From 1538d4060339461609f8a513cf4933a4de4fa8df Mon Sep 17 00:00:00 2001 From: Alexey Kachayev Date: Sat, 31 Mar 2018 11:03:50 +0300 Subject: [PATCH] AbstractMap to handle cons with java Map correctly --- src/potemkin/collections.clj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/potemkin/collections.clj b/src/potemkin/collections.clj index 9b541b4..ae2c031 100644 --- a/src/potemkin/collections.clj +++ b/src/potemkin/collections.clj @@ -66,8 +66,14 @@ (= x (into {} this)))) (cons [this o] - (if (map? o) + (cond + (map? o) (reduce #(apply assoc %1 %2) this o) + + (instance? java.util.Map o) + (reduce #(apply assoc %1 %2) this (into {} o)) + + :else (if-let [[k v] (seq o)] (assoc this k v) this)))