title: Which of Files.readAllLines or Files.lines method is faster for file reading?
body: <p>I have a file reader, which returns the lines of a file as an <code>Object[]</code>. I am using the <code>lines</code> method. Would it be faster to use <code>readAllLines</code>? I do not use the stream for anything else, but I want <code>currentBookData</code> to be a <code>String[]</code> or <code>Object[]</code>.</p>
  
  <pre><code>package input;
  import java.io.IOException;
  import java.nio.charset.Charset;
  import java.nio.file.Files;
  import java.nio.file.Paths;
  import java.util.stream.Stream;
  
  public class ReadFile {
  
      public static Object[] currentBookData;
  
      public static void getBookData(String path) throws IOException {
          try (Stream&lt;String&gt; stream = Files.lines(Paths.get(path), Charset.defaultCharset())) {
              currentBookData = stream.toArray();
          }
  
          catch (IOException ex) {
              System.out.println(ex.getMessage());
          }
      }
  
  }
  </code></pre>