You're viewing version 1.2.0 of new. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

2 Examples top

  • ;; Create a Java ArrayList using the 0 argument constructor
    user=> (def a  (new java.util.ArrayList))
    user=> (.add a "aaa")
    user=> (.add a "bbb")
    user=> a
    #<ArrayList [aaa, bbb]>
  • ;; Create another ArrayList and add integers using the doto macro
    user=> (def ai (doto (new java.util.ArrayList) (.add 1) (.add 2) (.add 0)))
    user=> ai
    #<ArrayList [1, 2, 0]>
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for new. Log in to add a comment.