On Sep 1, 11:10 am, Lauri Pesonen <lauri.peso...@iki.fi> wrote:
<snip>
> I just wanted to point out that the Java Properties class inherits
> Hashtable which is already (into) compatible, i.e.
>
> user> (let [props (. System getProperties)]
> ((into {} props) "os.arch"))
> "x86"
Ok. That is certainly a more concise way of doing it. In my case, that
would amount to:
(def properties-map
(with-open [s (.getResourceAsStream java.lang.String "/resources/
myresource.properties")]
(into {} (doto (java.util.Properties.) (.load s)))))
However, the change could still be valid for other cases.
Also this approach requires more memory as it has two live maps (one
properties and one persistent map) while the persistent map is being
built. Without creating a full "properties" object it is possible to
"stream" the entries into the persistent map. Granted, often this
would not be a problem.
P.S. I realize that the change would also need to be made to
APersistentMap cons method.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---