Implementation
Memory Efficiency
An object implementing the java.io.Closeable
is not closed
Memory Efficiency
The object should be closed properly with
import java.io.Closable
Closable object = ...
// do anything with object
object.close();
Currently Android only supports Java 6. But if it will support Java 7 one can also use the java.lang.AutoCloseable
interface in conjunction with the try-with-ressources statement:
try (AutoCloseable object = ...) {
object.doStuff();
}