C# supports disposable pattern for deterministic garbage collection using the dispose pattern.
Is there such pattern for java?
Java 7 has autoclosable
, which you can use with try finally blocks to invoke the close
method.
What about versions prior to 7?
Is there a disposable pattern (deterministic garbage collection) for Java 5 or 6?