title: Create a list of objects from a list of String in groovy
body: <p>I am having a list of string as follows.</p>
  
  <pre><code>List l = ["1","2","3"]
  </code></pre>
  
  <p>And I have a class like as follows.</p>
  
  <pre><code>class person {
      String name
  }
  </code></pre>
  
  <p>I want to create a list of person object from List l.</p>
  
  <p>I have tried using groovy list collect but I am not able to do so.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>class testJsonSlurper {
      static void main(String[] args) {
          List l = ["1","2","3"]
          def l2 = l.collect { new person(it) }
          println(l2)
      }
  }
  </code></pre>
  
  <p>But I getting following error.</p>
  
  <pre><code>Exception in thread "main" groovy.lang.GroovyRuntimeException: Could not find matching constructor for: testJsonSlurper$person(java.lang.String)
  </code></pre>