MapEntry

typesince v1.9.542 clojure.lang/MapEntryEdit
satisfies IAssociative ICollection IComparable ICounted IEmptyableCollection IEquiv IFind IFn IHash IIndexed ILookup IMapEntry IMeta IPrintWithWriter IReduce IReversible ISeqable ISequential IStack IVector IWithMeta

(MapEntry. key val __hash)

Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(deftype MapEntry [key val ^:mutable __hash]
  Object
  (indexOf [coll x]
    (-indexOf coll x 0))
  (indexOf [coll x start]
    (-indexOf coll x start))
  (lastIndexOf [coll x]
    (-lastIndexOf coll x (count coll)))
  (lastIndexOf [coll x start]
    (-lastIndexOf coll x start))

  IMapEntry
  (-key [node] key)
  (-val [node] val)

  IHash
  (-hash [coll] (caching-hash coll hash-ordered-coll __hash))

  IEquiv
  (-equiv [coll other] (equiv-sequential coll other))

  IMeta
  (-meta [node] nil)

  IWithMeta
  (-with-meta [node meta]
    (with-meta [key val] meta))

  IStack
  (-peek [node] val)

  (-pop [node] [key])

  ICollection
  (-conj [node o] [key val o])

  IEmptyableCollection
  (-empty [node] nil)

  ISequential
  ISeqable
  (-seq [node] (IndexedSeq. #js [key val] 0 nil))

  IReversible
  (-rseq [node] (IndexedSeq. #js [val key] 0 nil))

  ICounted
  (-count [node] 2)

  IIndexed
  (-nth [node n]
    (cond (== n 0) key
          (== n 1) val
          :else    (throw (js/Error. "Index out of bounds"))))

  (-nth [node n not-found]
    (cond (== n 0) key
          (== n 1) val
          :else    not-found))

  ILookup
  (-lookup [node k] (-nth node k nil))
  (-lookup [node k not-found] (-nth node k not-found))

  IAssociative
  (-assoc [node k v]
    (assoc [key val] k v))
  (-contains-key? [node k]
    (or (== k 0) (== k 1)))

  IFind
  (-find [node k]
    (case k
      0 (MapEntry. 0 key nil)
      1 (MapEntry. 1 val nil)
      nil))

  IVector
  (-assoc-n [node n v]
    (-assoc-n [key val] n v))

  IReduce
  (-reduce [node f]
    (ci-reduce node f))

  (-reduce [node f start]
    (ci-reduce node f start))

  IFn
  (-invoke [node k]
    (-nth node k))

  (-invoke [node k not-found]
    (-nth node k not-found)))