PersistentArrayMap.createAsIfByAssoc

functionsince v1.9.456Edit
(PersistentArrayMap.createAsIfByAssoc init)

Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(set! (.-createAsIfByAssoc PersistentArrayMap)
  (fn [init]
    ;; check trailing element
    (let [len           (alength init)
          has-trailing? (== 1 (bit-and len  1))]
      (if-not (or has-trailing? (pam-dupes? init))
        (PersistentArrayMap. nil (/ len 2) init nil)
        (.createAsIfByAssocComplexPath PersistentArrayMap init has-trailing?)))))