The fastest way to read a line in a line

I have a huge file with lines. All lines should be added to the list in my code. What is the fastest way to do this? I found this one , but I do not know how to use it to read a line in a line.

+3
source share
1 answer

I suspect the inline solution should be fast enough:

List<String> allLines = Files.readAllLines(Paths.get("location/of/your/file"));

(if your JVM has enough memory)

+5
source

Source: https://habr.com/ru/post/1615668/


All Articles