How would you make a method to read a text file in java, given that the text file has 20,000 rows. The first element of the row is a word and the rest 50 values are the corresponding word vector
Asked
Active
Viewed 63 times
1 Answers
1
There are multiple options, with the best choice depending on the specific considerations of your use case. The syntax of course depends on that choice. Some of the main options are BufferedReader.readLine(), Files.readAllLines(Path path), FileInputStream and Files.newBufferedReader(Path path), or even external libraries such as LineIterator from Apache FileUtils.
Files.readAllLines may be the simplest option to implement and most straightforward to read. Files.newBufferedReader may be one of the more efficient.

Woodchuck
- 3,869
- 2
- 39
- 70