/** @deprecated unclear closing policy, do not use (to remove in IDEA 14) */ @SuppressWarnings("UnusedDeclaration") public static List<String> loadLines(@NotNull Reader reader) throws IOException { BufferedReader bufferedReader = new BufferedReader(reader); try { return loadLines(bufferedReader); } finally { bufferedReader.close(); } }
@NotNull public static List<String> loadLines(@NotNull Reader reader) throws IOException { List<String> lines = new ArrayList<String>(); BufferedReader bufferedReader = new BufferedReader(reader); try { String line; while ((line = bufferedReader.readLine()) != null) { lines.add(line); } } finally { bufferedReader.close(); } return lines; }