- it will produce OOM if file is very large
A well designed API won't give you an OOM it'll throw a 'this file is too big'
- not sure why you would want to have path and filename as separate params
Throws path not found. Throws file not found. Why does the programmer need to deal with twee-fiddly path magic for say each file in a directory of config files?
Iterable<String> Files.readAllLines(String fileName);
Oh sure that's totally more readable.
I think in python it will lazely iterate through the file,
I wrote a program to suck in a list of log files and generate a bunch of metrics and display them. Users liked to select a dozen 100MB log files. Lazy iteration was way way too slow. Fastest was suck each one into memory and call split.