title: What is the best possible way to read the data from a file using readFile and converting it to a List in groovy?
body: <p>I'm trying to read values from text files and putting the values into the list using the below method.</p>
  
  <pre><code>def myKeys = []
  new File( '/tmp/A.txt' ).eachLine { line -&gt;
      myKeys &lt;&lt; line
  }
  
  def myValues = []
  new File( '/tmp/B.txt' ).eachLine { line -&gt;
      myValues &lt;&lt; line
  }
  </code></pre>
  
  <p>Problem is, Jenkins doesn't allow this to run on a slave and I'm not sure how to use <code>readFile</code> method here because it doesn't solve the purpose. I want to create a List, which <code>readFile</code> couldn't do.</p>