How to create an arrayList in clojure

0

How to create a ListList in clojure and add elements? (the existing one in java)

My problem is this: I need to read a file and add substrings of that file (space-delimited and "\ n" line break) as separate elements in that array.

I can read, delimit the spaces, however I can not import the way to declare arrayList of java and I do not know how to do it.

    
asked by anonymous 08.10.2017 / 17:30

1 answer

0

You can use split-lines to do it all at once:

(:require string :as string]))
  (string/split-lines "1\n2\n3") ; resultado: ["1", "2", "3"]
    
25.02.2018 / 22:08