I have an mail object that returns its headers as an Enumerator of Header objects, which have two methods, getName and getValue. I need to convert that to a nice Clojure map so I wrote this short function:
(defn extract-headers [message]
(reduce (fn [hs h] (conj hs {(.getName h) (.getValue h)}))
{}
(enumeration-seq (.getAllHeaders message))))
Anything to change or improve here?