Hacker News new | ask | show | jobs
by reverend_gonzo 5515 days ago
I've taken Groovy's with... syntax and built utils that are ie:

public void withConnection(Callback<Connection> callback) { Connection connection = createConnection(); try { callback.call(connection); } finally { connection.dispose(); } }

Once Java actually gets closures it'll make this soooo much nicer.