3 ms·
For those more familiar with Java, this looks like this is very similar to Java's try-with-resources: static String readFirstLineFromFile(String path) throws
by the-alchemist 3y ago
For those more familiar with Java, this looks like this is very similar to Java's try-with-resources:
static String readFirstLineFromFile(String path) throws IOException {
try (FileReader fr = new FileReader(path);
BufferedReader br = new BufferedReader(fr)) {
return br.readLine();
}
}
Instead of defining a function with Symbol.dispose, you have to implement the java.io.Closeable interface.
Java has had this since, cough cough 2014.