2 Examples top

  • ;; Create a Java ArrayList using the 0 argument constructor
    user=> (def a  (new java.util.ArrayList))
    #'user/a
    user=> (.add a "aaa")
    true
    user=> (.add a "bbb")
    true
    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
    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.